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)
- Legal (gograb-space):
tools/scripts/build/prerender-legal-pages.jsruns after production build; slugs and SEO metadata come fromlibs/libs-structural/legal-lib/.../legal.constants.ts; outputs staticindex.htmlper route for bots. - Docs:
tools/scripts/build/prerender-docs-pages.jsruns as part ofdocs:build:prod(package.json); injects markdown fromdocs/english/{source}/index.mdinto the Angular shell for a fixed list of paths (DOC_PAGESin that script). - Runtime:
DocumentationSeoService+@libs-foundational/brand-seoupdate meta/JSON-LD for clients that execute JavaScript; this does not replace bot-readable HTML for URLs that matter for indexing. - Gap:
robots.txtreferenceshttps://docs.gograb.space/sitemap.xml— confirm that file is produced at deploy; if missing, crawlers get 404 on sitemap.
2. Goals
- Selective indexing: Not every documentation project needs to be static/SEO-oriented; internal or session-heavy trees should default to
noindexand no prerender cost. - 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. - 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 |
public-index: Allow indexing; include in generatedsitemap.xml(when implemented); prerender root ifprerenderRootis true.noindex: Runtime metanoindex; exclude from sitemap; no prerender unless product explicitly needs a share preview (then usenoindex+ OG tags only — decide per product).internal: Same asnoindexfor crawlers; may additionally be excluded from public builds (future).
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)
- Generate prerender config during
configure-docs-path/generate-folders-config(or a small pre-build script): emittools/scripts/build/docs-prerender-targets.json(or TS module) listing{ path, sourceDir, crawlPolicy, prerenderRoot }. - Refactor
prerender-docs-pages.jsto read that artifact instead of hardcodedDOC_PAGES; skip entries whereprerenderRootis false orcrawlPolicyis notpublic-index. - Sitemap: Add
tools/scripts/build/generate-docs-sitemap.jsinvoked indocs:build:prod, outputdist/.../browser/sitemap.xmlwith onlypublic-indexURLs that have a stable public path. Align URL shape with production routing (hash vs path — must be validated against Cloudflare_redirectsand AngularwithHashLocation()). - Robots: Keep
Allow/Disallow; ensure sitemap URL matches deployed asset.
5. Runtime changes (plan)
- For projects with
noindex/internal, set robots meta (and optionallyX-Robots-Tagvia hosting) on doc routes — implementation detail inDocumentationSeoServiceor route metadata. - Hash-based URLs complicate canonical and crawler behavior; document the public URL contract for “SEO-important” pages (prefer path-based public URLs for those routes only, if feasible).
6. Risks & edge cases
- Duplicate content (EN/ES): require explicit
canonical/hreflangbefore scaling indexed locales. - Preview deploys: Non-prod hosts should ship
noindexand a differentrobots.txtor block crawlers. - Drift: Any hand-maintained list in
prerender-docs-pages.jswill rot; automation from folder config is mandatory at scale.
7. Acceptance criteria
- No duplicate manual list: prerender inputs come from generated config.
-
sitemap.xmlexists at the URL advertised inrobots.txtorrobots.txtis updated. - Internal/session projects are not in sitemap and carry
noindexwhen loaded. - CI fails or warns if a
public-indexproject lacks a prerender source file.
8. Out of scope (for this spec)
- Full SSR of the entire docs app.
- Server-side analytics aggregation (admin dashboards currently use session-local data unless
environment.enableAnalyticspersistence is enabled).