Problem statement
The template has no machine-readable hints that help search engines and AI tools discover and index the documentation site efficiently. Specifically:
- No
sitemap.xml — Google must discover pages via crawl only. New pages take weeks to be indexed.
- No
robots.txt — no directives to crawlers, no link to a sitemap.
- No favicon — adopters see a grey square in the browser tab. Cheap to fix, professional touch missing.
For a public template, every adopter inherits these gaps.
Proposed solution
Add three small route files at the App Router level:
src/app/sitemap.ts — exports a MetadataRoute.Sitemap built from source.getPages() with each page's URL, lastModified, and priority.
src/app/robots.ts — exports a MetadataRoute.Robots with Allow: / and Sitemap: <absolute URL>.
src/app/icon.tsx (or icon.png) — Next.js auto-handles favicon generation.
References:
Acceptance criteria
Alternatives considered
- Third-party sitemap packages (e.g.
next-sitemap). Rejected — Next.js 16's built-in support is sufficient and avoids a dependency.
- Dynamic
robots.txt from a Route Handler. Rejected — robots.ts is the modern App Router pattern and integrates with MetadataRoute.
- Static favicon as PNG asset. Equivalent outcome; pick whichever is easier.
Risks
- A syntax error in
robots.txt can accidentally de-index the entire site. Mitigation: validate output in CI.
- Sitemap URL must be absolute — depends on
metadataBase from the rich metadata issue.
Related
- Sibling issue: rich metadata (depends on this for absolute URLs via
metadataBase)
- Sibling issue: JSON-LD structured data
- Next.js metadata conventions (linked above)
Problem statement
The template has no machine-readable hints that help search engines and AI tools discover and index the documentation site efficiently. Specifically:
sitemap.xml— Google must discover pages via crawl only. New pages take weeks to be indexed.robots.txt— no directives to crawlers, no link to a sitemap.For a public template, every adopter inherits these gaps.
Proposed solution
Add three small route files at the App Router level:
src/app/sitemap.ts— exports aMetadataRoute.Sitemapbuilt fromsource.getPages()with each page's URL,lastModified, andpriority.src/app/robots.ts— exports aMetadataRoute.RobotswithAllow: /andSitemap: <absolute URL>.src/app/icon.tsx(oricon.png) — Next.js auto-handles favicon generation.References:
Acceptance criteria
/sitemap.xmlreturns valid XML listing every page fromsource.getPages()/robots.txtallows all crawlers and references the sitemap absolute URL/,/docs, and any sub-routeAlternatives considered
next-sitemap). Rejected — Next.js 16's built-in support is sufficient and avoids a dependency.robots.txtfrom a Route Handler. Rejected —robots.tsis the modern App Router pattern and integrates withMetadataRoute.Risks
robots.txtcan accidentally de-index the entire site. Mitigation: validate output in CI.metadataBasefrom the rich metadata issue.Related
metadataBase)