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 🙏

© 2026 – Pkg Stats / Ryan Hefner

astro-md-alternate

v0.1.0

Published

Serve markdown versions of your Astro content pages for AI agents and LLMs. Adds .md endpoints and <link rel="alternate"> auto-discovery.

Readme

astro-md-alternate

Serve markdown versions of your Astro content pages for AI agents and LLMs.

Websites have always been built for two audiences: humans and search engines. AI agents are now the third audience, and most websites aren't optimized for them. This integration fixes that by making your content available as clean markdown alongside HTML.

What it does

  • Generates a .md endpoint for each page in your content collections (e.g. /post/my-article.md)
  • Provides a <MarkdownAlternateLink> component that adds <link rel="alternate" type="text/markdown"> to your HTML <head> for auto-discovery
  • Strips MDX-specific syntax (imports, JSX components) to produce clean, readable markdown
  • Works at build time with static output -- no server required

Install

npm install astro-md-alternate

Setup

1. Add the integration

// astro.config.mjs
import mdAlternate from "astro-md-alternate";

export default defineConfig({
  integrations: [
    mdAlternate({
      collections: [
        { name: "post", pattern: "/post/[slug]" },
      ],
    }),
  ],
});

2. Add the auto-discovery link

In your <head> layout (e.g. BaseHead.astro or BaseLayout.astro):

---
import { MarkdownAlternateLink } from "astro-md-alternate/components";
---

<head>
  <!-- your existing head content -->
  <MarkdownAlternateLink patterns={["/post/"]} />
</head>

That's it. Your blog posts now have markdown versions that AI agents can discover and consume.

Configuration

Integration options

mdAlternate({
  collections: [
    {
      // Required: content collection name
      name: "post",
      // Required: URL pattern matching your page route
      pattern: "/post/[slug]",
      // Optional: frontmatter fields to include (defaults shown below)
      fields: ["title", "description", "pubDate", "updatedDate", "authors", "categories"],
    },
    // Add multiple collections
    {
      name: "docs",
      pattern: "/docs/[slug]",
      fields: ["title", "description", "lastUpdated"],
    },
  ],
  // Optional: strip MDX syntax from output (default: true)
  stripMdx: true,
});

Component props

<!-- Only add the link tag on pages matching these path prefixes -->
<MarkdownAlternateLink patterns={["/post/", "/docs/"]} />

<!-- Add to all pages (no filtering) -->
<MarkdownAlternateLink />

How it works

  1. At build time, the integration generates a static API endpoint for each entry in your configured content collections
  2. Requesting /post/my-article.md returns the post's content as clean markdown with YAML frontmatter
  3. The <MarkdownAlternateLink> component renders a <link rel="alternate" type="text/markdown"> tag that crawlers use for auto-discovery (similar to RSS <link> tags)

Example output

Requesting https://example.com/post/my-article.md returns:

---
title: "My Article"
description: "A description of the article"
date: 2025-01-15
authors: [jane]
categories: [Tech, AI]
url: https://example.com/post/my-article/
---

The full markdown body of your article, with MDX imports
and JSX components automatically stripped for readability.

Background

This implements the "third audience" pattern described by Dries Buytaert, providing the same features as WordPress's Markdown Alternate plugin but for Astro sites.

License

MIT