npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@astropub/doc

v0.1.4

Published

Create document layouts with minimal markup in Astro

Downloads

12

Readme

Astro Doc

Astro Doc lets you create document layouts with minimal markup in Astro.

NPM Version NPM Downloads Open in StackBlitz

You write this:

---
import Document from '@astropub/doc'
---
<Document title="Astro Doc" body-class="p-body">
  <h1>
    Astro Doc
  </h1>
  <p>
    The HTML, HEAD, and BODY tags are all set.
  </p>
</Document>

You get this:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Astro Doc</title>
    <meta name="viewport" content="width=device-width" />
    <meta name="disabled-adaptations" content="watch" />
    <meta property="og:title" content="Astro Doc" />
  </head>
  <body class="p-body">
    <h1>
      Astro Doc
    </h1>
    <p>
      The HTML, HEAD, and BODY tags are all set.
    </p>
  </body>
</html>

Open in StackBlitz

Usage

Install Astro Doc to your project.

npm install @astropub/doc

Use Astro Doc components in your project.

---
import Document from '@astropub/doc'
---
<Document>
  <p>
    The HTML, HEAD, and BODY tags are all set.
  </p>
</Document>

You get this:

<!doctype html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <meta name="disabled-adaptations" content="watch" />
  </head>
  <body>
    <p>
      The HTML, HEAD, and BODY tags are all set.
    </p>
  </body>
</html>

Features

Embedded Attributes

title

Defines the title of the document, without any additional taglines.

<meta property="og:title" content={title} />

description

Defines the summary of the content of the current document.

<meta name="description" content={description} />

sitetitle

Defines the title of the site, without any additional taglines.

<meta property="og:site_name" content={sitetitle} />

tabtitle

Defines the title of the document used by the tab, which may include additional taglines.

<title>{title}</title>

type

Defines the category or type of the current document. By default, this is webpage.

<meta property="og:type" content={type} />

url

Defines the canonical URL of the current document. By default, this is the value of Astro.url. If the URL does not include a protocol or domain, it will be resolved against Astro.site.

<meta property="og:url" content={resolvedURL(url)} />

imageurl

Defines the URL of the image representing the current document. If the URL does not include a protocol or domain, it will be resolved against Astro.site.

<meta property="og:image" content={resolvedURL(imageurl)} />

imagealt

Defines the description for the image representing the current document.

<meta property="og:image:alt" content={imagealt} />

twittercard

Defines the summary card used by Twitter. By default, this is summary_large_image if imageurl is defined.

<meta name="twitter:card" content={twittercard} />

Note: This is the only embedded attribute not shared across social networks.

robots

How search engines should follow the current document.

<meta name="robots" content={robots} />

Application Attributes

viewport

Defines the area through which the document is viewed.

<meta name="viewport" content={viewport} />

disabledadaptations

Defines whether the website is compatible without adaptations smaller viewports.

<meta name="disabled-adaptations" content={disabledadaptations} />

icon

Defines the image used by the website to represent the current document in some browser tabs, browser history views, toolbar apps, bookmarks dropdowns, search bars, and search bar recommendations. The type will be automatically detected.

<link rel="icon" href={icon} type={resolvedIconType(icon)} />

touchicon

Defines the image used by common handheld devices, such as Apple or Android phones. Presently, the size is hard-coded to 180x180.

<link rel="apple-touch-icon" sizes="180x180" href={touchicon} />

charset

Defines the character encoding for the document. By default, this is utf-8.

<meta charset={charset} />

Head Slot

Additional elements may be placed in the <head> tag thru use of the head slot.

---
import Document from '@astropub/doc'
---
<Document title="Astro Doc" body-class="p-body">
  <meta slot="head" name="twitter:creator" content="@jon_neal" />
  <link slot="head" rel="alternate" type="application/rss+xml" title="Blog" href="/blog.xml" />

  <h1>
    Astro Doc
  </h1>
  <p>
    The HTML, HEAD, and BODY tags are all set.
  </p>
</Document>