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
articlemetadata andmodifiedTimefromsource.updated(page) keywordsfrom frontmatterrobots: { index: false, follow: false }whenever a page hashidden: trueordraft: 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).
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.
This exposes three public endpoints:
Page actions and prompts
CopyMarkdownActionandOpenPageMenuinPageHeaderread the same.mdURLs automatically.<AgentPrompt>expands{origin},{page},{llms}, and{llms-full}inside fenced prompt blocks usingsite.urland the current route.- You can customize which agents appear globally via
defineSite({ agents, openIn })or per prompt with<AgentPrompt agents={[...]}>.