• Verified
  • Free plan

site-md

Listed under GitHub repos

site-md is an open source npm package for Next.js sites that serves clean Markdown versions of pages to AI agents and crawlers, while human visitors keep getting HTML. It also generates llms.txt files.

Used for

  • markdown page serving
  • llms.txt generation
  • ai crawler handling

What site-md does

site-md is a TypeScript package for Next.js sites. It installs middleware and a route handler so the same page is returned as HTML to browsers and as Markdown to agents, using either a .md suffix or an Accept: text/markdown header. No content is duplicated and no pages are rewritten, because the Markdown is produced from pages the site already publishes.

The CLI detects your package manager and src layout, writes the middleware and route files, and wraps next.config with withNextMd. If a middleware.ts already exists it is merged by AST so existing logic and matcher survive. A /llms.txt index is served without extra setup, and optional settings tune caching, bot categories and the internal route prefix.

Key features

One command install
npx site-md detects pnpm, npm, yarn or bun and the src layout, then installs the package and wires the files.
AST merge into middleware
An existing middleware.ts is merged rather than replaced, preserving your own logic and matcher settings.
Markdown by file extension
GET /docs.md returns Markdown while GET /docs returns HTML for the same page.
Accept header negotiation
Requests sending Accept: text/markdown are treated as agents and receive Markdown instead of HTML.
llms.txt site index
A Markdown index of the site is served at /llms.txt with no extra configuration.
Next config wrapping
withNextMd wraps next.config.ts, mjs, js or cjs, or creates the config file when absent.
Per category bot policy
Each bot category accepts a policy value such as markdown, set through optional configuration.
Non-interactive CI install
Flags --title, --description and --yes let CI jobs or agent scripts run the installer without prompts.
Bypass header on self-fetch
Internal self-fetches carry a bypass header so they cannot loop back through agent detection.
Configurable route prefix
internalRoutePrefix changes the internal route path and must match your middleware matcher.

How it works

  1. Run npx site-md in the root of a Next.js project.
  2. The CLI detects the package manager and src layout, then installs the package.
  3. It writes middleware.ts, or AST-merges the code into an existing file.
  4. It writes the route handler at app/api/site-md/[...path]/route.ts.
  5. It wraps next.config with withNextMd or creates the config file.
  6. Restart the dev server and request /index.md or /llms.txt.
  7. Agent requests get Markdown, while human requests still receive the HTML page.

Plans and pricing

Free and open source under the MIT licence, with no paid tiers listed.

Integrations and platforms

Works with

  • Next.js
  • npm
  • pnpm
  • yarn
  • bun

Available as

  • Web
  • API
  • CLI

Repository facts

  • Repositoryyazinsai/site-md
  • LanguageTypeScript
  • Stars58
  • Forks4
  • LicenceMIT
  • Created2026-04-20
  • Last commit2026-04-21
  • Open issues0
  • ai-agents
  • content-negotiation
  • crawler
  • llm
  • llms-txt
  • markdown
  • middleware
  • nextjs
  • seo
  • typescript

Services and details

  • Does SEO work itself

    Yes
  • AI search visibility

    Yes
  • Free plan or free tools

    Yes
  • API or MCP server

    Yes

No information yet on keyword research, content optimization, writes content with AI, technical audits, rank tracking, backlinks and link building, local SEO, free trial, WordPress plugin, browser extension, built for agencies. The website did not say; check with the vendor.

Compare with other SEO tools:

About the company

Listing compiled from public sources and the product's own website. Last updated 2026-11-12. Report a correction or request removal. Back to GitHub repos.