Docs SEO & Crawl Policy — Specification & Implementation Plan

Selective static HTML, crawl/index policy, and alignment with prerender scripts

Docs SEO & Crawl Policy

1. Context (verified in repo)

2. Goals

  1. Selective indexing: Not every documentation project needs to be static/SEO-oriented; internal or session-heavy trees should default to noindex and no prerender cost.
  2. Single source of truth: Prerender targets, robots/noindex, and optional sitemap entries must derive from the same project metadata the app uses (e.g. folders config / manifest), not a second hardcoded list.
  3. Operational clarity: Engineers know which routes get static HTML, which are SPA-only, and what is indexed.

3. Policy model (proposed)

Per root documentation project (or per language root):

Field Purpose
crawlPolicy public-index | noindex | internal
prerenderRoot If true and project has a routable index doc, include in post-build prerender list
canonicalHost Optional; if docs split across hosts later

Assumption: crawlPolicy lives in the same JSON/YAML that backs project selection (e.g. generated docs-folders-config / manifest). Verify the exact schema file name and build step before implementing.

4. Build pipeline changes (plan)

  1. Generate prerender config during configure-docs-path / generate-folders-config (or a small pre-build script): emit tools/scripts/build/docs-prerender-targets.json (or TS module) listing { path, sourceDir, crawlPolicy, prerenderRoot }.
  2. Refactor prerender-docs-pages.js to read that artifact instead of hardcoded DOC_PAGES; skip entries where prerenderRoot is false or crawlPolicy is not public-index.
  3. Sitemap: Add tools/scripts/build/generate-docs-sitemap.js invoked in docs:build:prod, output dist/.../browser/sitemap.xml with only public-index URLs that have a stable public path. Align URL shape with production routing (hash vs path — must be validated against Cloudflare _redirects and Angular withHashLocation()).
  4. Robots: Keep Allow/Disallow; ensure sitemap URL matches deployed asset.

5. Runtime changes (plan)

6. Risks & edge cases

7. Acceptance criteria

8. Out of scope (for this spec)