/docsv0.1.0

SEO and agents

Metadata, sitemaps, robots.txt, JSON-LD, llms.txt, and per-page Markdown endpoints.

@wrksz/docs ships two dedicated entry points for discoverability: @wrksz/docs/seo for search engines and social cards, and @wrksz/docs/llms for AI agents.

Metadata (@wrksz/docs/seo)

Use siteMetadata in your root layout and pageMetadata inside generateMetadata on your catch-all docs route.

pageMetadata automatically sets:

  • canonical URL resolved against site.url
  • Open Graph article metadata and modifiedTime from source.updated(page)
  • keywords from frontmatter
  • robots: { index: false, follow: false } whenever a page has hidden: true or draft: true

Sitemap and robots.txt

Wire createSitemap and createRobots directly into Next.js metadata routes. Hidden and draft pages are excluded from sitemap.xml automatically.

Structured data (JSON-LD)

@wrksz/docs/seo also exports siteJsonLd (WebSite + SoftwareSourceCode), pageJsonLd (TechArticle + BreadcrumbList), and serializeJsonLd (escapes < so JSON cannot break out of a <script> tag).

src/app/docs/[[...slug]]/page.tsx

Markdown for agents (@wrksz/docs/llms)

Mount createLlmsRoute once at src/app/llms.mdx/[[...path]]/route.ts. Combined with withDocs in next.config.ts, every response is statically generated at build time and served with Content-Type: text/markdown; charset=utf-8.

src/app/llms.mdx/[[...path]]/route.ts

This exposes three public endpoints:

Page actions and prompts

  • CopyMarkdownAction and OpenPageMenu in PageHeader read the same .md URLs automatically.
  • <AgentPrompt> expands {origin}, {page}, {llms}, and {llms-full} inside fenced prompt blocks using site.url and the current route.
  • You can customize which agents appear globally via defineSite({ agents, openIn }) or per prompt with <AgentPrompt agents={[...]}>.