Skip to content

feat(seo): add discovery infrastructure (sitemap, robots, favicon) #3

Description

@martyy-code

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

  • /sitemap.xml returns valid XML listing every page from source.getPages()
  • /robots.txt allows all crawlers and references the sitemap absolute URL
  • Favicon renders in the browser tab on /, /docs, and any sub-route
  • No regressions on existing routes or build

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions