LearnNewsExamplesConnect
Frontmatter
assigneesneo-gemini-julia
createdAtNov 10, 2026, 3:42 PM
updatedAtNov 10, 2026, 11:48 PM
githubUrlhttps://github.com/neomjs/neo/issues/20727
authorneo-gemini-julia
commentsCount1
parentIssue20671
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 10, 2026, 11:48 PM

Add populated /examples/ routes to seo.json and sitemap-core.xml

Closed v14.0.0/archive-v14-0-0-chunk-1 enhancementaibuildportal
neo-gemini-julia
neo-gemini-julia commented on Nov 10, 2026, 3:42 PM

Parent: #20671 · Companion: neomjs/middleware-v2#59 / PR #60 · Handoff from: #20690 (AC-8) & PR #20703 (Post-Merge Validation) · Target window: before the v13.5 cut (2026-11-23)

Context

In #20690 (PR #20703, merged at 56a333fbac), the Portal examples section switched to component-family navigation (apps/portal/view/examples/TabContainer.mjs:40–48 familyDefinitions: /examples, /examples/grid, /examples/forms, /examples/multi-window, /examples/calendar, /examples/components, /examples/state). TabContainerController#onCatalogLoad (apps/portal/view/examples/TabContainerController.mjs:49–69) publishes tabs only for families that have records in apps/portal/resources/data/examples.json, while TabContainerController#onExamplesRoute (lines 75–93) resolves unpopulated family routes and legacy build routes (dist_prod, dist_esm, dist_dev, devmode) to the /examples (Featured) tab.

#20688 (PR #20689) and #20690 (AC-8) explicitly deferred /examples/<family> SEO metadata and sitemap integration to #20671 once the family route structure landed.

  • Live latest-open + closed sweep: checked latest 25 open issues (#20726, #20724, #20722, #20720, #20717, #20715, #20671, etc.; 26 open total, orange band 25–50, filed as a planned leaf under parent epic #20671) and closed search (examples family seo sitemap, read Out of Scope / Avoided Traps on #20690 and #20688) at 2026-11-10T14:40:26Z; no duplicate or prior exclusion found.
  • A2A in-flight claim sweep: checked 30 newest messages across all read states (list_messages({status: 'all', projection: 'compact', limit: 30})) at 2026-11-10T14:40:20Z; no competing claim on /examples/<family> SEO/sitemap wiring.
  • Memory Core & own-assignment sweep: query_raw_memories("Portal examples family routes /examples/grid missing from seo.json and sitemap-core.xml") (5 results, no prior decision) and gh issue list --repo neomjs/neo --state open --assignee @me (2 open: #20671, #20715; bodies read).
  • Structure map: N/A (modifies existing files in buildScripts/docs/seo/, apps/portal/, and test/playwright/unit/; no ai/ surfaces or new .mjs files).
  • Ownership disposition: assignee: @neo-gemini-julia (Cornerstone 4 steward under #20671; excluded from good first issue because it completes the immediate post-merge handoff from #20690 / PR #20703 and neomjs/middleware-v2#59).

Design Authority

  • #20671 (ROADMAP.md Engine 13.5 Cornerstone 4 — Search engines and agents find and classify neomjs.com)
  • #20690 (AC-8 & Contract Ledger: /examples/<family> routes enter seo.json and the sitemap once available families land, while familyDefinitions in apps/portal/view/examples/TabContainer.mjs remains the single source of truth)
  • #20688 / PR #20689 (buildScripts/docs/seo/seoJson.mjs and Portal.service.Seo)

The Problem

Measured on dev at 56a333fbac:

  1. Populated /examples/<family> routes are absent from apps/portal/resources/data/seo.json, sitemap-core.xml, llms.txt, and getContentRouteObjects():
    • apps/portal/resources/data/examples.json currently has 21 published records with family: 'grid-table' (making /examples/grid a live published family tab), and subsequent leaves under #20498 will populate forms, multi-window, calendar, components, and state.
    • Neither buildScripts/docs/seo/seoJson.mjs#getSeoJson nor buildScripts/docs/seo/generate.mjs#collectAllRoutes reads familyDefinitions and examples.json, so /examples/grid (and future populated /examples/<family> routes) has no entry in seo.json, sitemap-core.xml, llms.txt, or getContentRouteObjects().
  2. Unpopulated /examples/<family> routes and legacy build routes emit self-referential canonical URLs in Portal.service.Seo instead of canonicalizing to /examples:
    • When a user or crawler visits /#/examples/forms (while forms has 0 records in examples.json) or /#/examples/dist_prod, TabContainerController#onExamplesRoute (apps/portal/view/examples/TabContainerController.mjs:88–92) falls back to the /examples (Featured) tab.
    • However, Portal.service.Seo#getMetadata (apps/portal/service/Seo.mjs:99–113) pops path segments to lookupRoute === '/examples' and returns route: normalizedRoute ('/examples/forms' or '/examples/dist_prod'), causing #updateDocumentHead to set <link rel="canonical" href="https://neomjs.com/examples/forms"> and og:url to the unpopulated/legacy URL rather than https://neomjs.com/examples.

The Architectural Reality

  • apps/portal/view/examples/TabContainer.mjs:40–48 (familyDefinitions) is the single ordered source of truth for family identity (family), title (title), and route (route). Because TabContainer.mjs imports UI classes and calls Neo.setupClass, Node build scripts (buildScripts/docs/seo/seoJson.mjs) can extract familyDefinitions directly from TabContainer.mjs's AST via acorn (already a devDependency used by buildScripts/util/check-*.mjs) without duplicating the table or booting the runtime.
  • Pairing familyDefinitions (definition.family !== null) with non-hidden records in apps/portal/resources/data/examples.json (!record.hidden && record.family === definition.family) determines which /examples/<family> routes are currently published, so adding records for forms, multi-window, calendar, components, or state under #20498 automatically adds their seo.json, sitemap-core.xml, llms.txt, and getContentRouteObjects() entries on regeneration.
  • In Portal.service.Seo#getMetadata, returning route: '/examples' when a nested /examples/* route falls back to lookupRoute === '/examples' aligns the browser's <link rel="canonical"> and og:url (https://neomjs.com/examples) with TabContainerController#onExamplesRoute's Featured tab fallback while preserving route: normalizedRoute for other section fallbacks (such as /news/tickets/123).

The Fix

  1. Derive published /examples/<family> metadata in buildScripts/docs/seo/seoJson.mjs (extractExampleFamilyDefinitions, getPublishedExampleFamilies, + getSeoJson) and regenerate apps/portal/resources/data/seo.json:
    • Parse familyDefinitions from apps/portal/view/examples/TabContainer.mjs via acorn (throwing on missing, non-array, or non-literal/incomplete AST entries, and accepting examplesPath, examplesTabContainerPath, and familyDefinitions options for isolated unit-test fixtures) and match each non-Featured family (definition.family !== null) against non-hidden records in apps/portal/resources/data/examples.json.
    • Exclude route.startsWith('/examples/') from existingSeo preservation in getSeoJson so unpopulated or withdrawn family routes never linger, and emit {title: 'Neo.mjs ${definition.title} Examples', description, schemaType: 'CollectionPage'} for every family with records.length > 0.
    • Regenerate apps/portal/resources/data/seo.json (adding /examples/grid).
  2. Include published /examples/<family> routes via collectExampleFamilyRoutes (buildScripts/docs/seo/seoJson.mjs, re-exported and consumed by buildScripts/docs/seo/generate.mjs):
    • Emit {category: 'example-family', filePath: examplesPath, id: definition.route, name: '${definition.title} Examples'} for each populated family route so getContentRoutes (/#/examples/grid), getContentRouteObjects ({route: '/examples/grid', clientSideRoute: '/#/examples/grid'}), getSitemapXml (https://neomjs.com/examples/grid at <priority>0.9</priority>, dated by examples.json), and getLlmsTxt (listed under ## Demo Apps and Examples) stay synchronized with examples.json.
  3. Canonicalize fallback /examples/* sub-routes to /examples in Portal.service.Seo#getMetadata (apps/portal/service/Seo.mjs):
    • When an unlisted /examples/* route falls back to lookupRoute === '/examples', return route: '/examples' so #updateDocumentHead sets canonicalUrl and og:url to 'https://neomjs.com/examples'.
  4. Add unit test coverage in test/playwright/unit/buildScripts/docs/seo/Generate.spec.mjs and test/playwright/unit/apps/portal/service/Seo.spec.mjs:
    • Verify populated vs unpopulated family handling in getSeoJson, getContentRoutes, getContentRouteObjects, getSitemapXml, getLlmsTxt, and Portal.service.Seo.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
extractExampleFamilyDefinitions, getPublishedExampleFamilies, & getSeoJson (buildScripts/docs/seo/seoJson.mjs, re-exported from generate.mjs) #20671, #20690 (TabContainer.mjs familyDefinitions + examples.json) Extracts familyDefinitions from TabContainer.mjs (throwing on unreadable/incomplete AST shapes) and emits {title, description, schemaType: 'CollectionPage'} in seo.json for each family with >= 1 non-hidden record in examples.json Unpopulated families (0 records) are omitted from seo.json JSDoc in seoJson.mjs test/playwright/unit/buildScripts/docs/seo/Generate.spec.mjs
collectExampleFamilyRoutes (buildScripts/docs/seo/seoJson.mjs, re-exported and consumed by buildScripts/docs/seo/generate.mjs) #20671, #20690 Includes populated /examples/<family> routes in getContentRoutes, getContentRouteObjects, getSitemapXml (priority: 0.9, dated by examples.json), and getLlmsTxt Unpopulated families are omitted until examples.json has records for them JSDoc in seoJson.mjs test/playwright/unit/buildScripts/docs/seo/Generate.spec.mjs
Portal.service.Seo#getMetadata (apps/portal/service/Seo.mjs) #20671, TabContainerController#onExamplesRoute Resolves populated /examples/<family> routes from seo.json and canonicalizes unlisted /examples/* fallback routes (lookupRoute === '/examples') to route: '/examples' (https://neomjs.com/examples) Non-/examples parent fallbacks (e.g. /news/tickets/123) keep route: normalizedRoute JSDoc in Seo.mjs test/playwright/unit/apps/portal/service/Seo.spec.mjs

Decision Record impact: none.

Acceptance Criteria

  • getSeoJson() in buildScripts/docs/seo/seoJson.mjs derives populated /examples/<family> entries from apps/portal/view/examples/TabContainer.mjs (familyDefinitions) and apps/portal/resources/data/examples.json without duplicating familyDefinitions, emitting /examples/grid (schemaType: 'CollectionPage') in apps/portal/resources/data/seo.json and omitting unpopulated families.
  • buildScripts/docs/seo/generate.mjs includes populated /examples/<family> routes in getContentRoutes, getContentRouteObjects, getSitemapXml (<loc>https://neomjs.com/examples/grid</loc> with <priority>0.9</priority>), and getLlmsTxt while omitting unpopulated families.
  • Portal.service.Seo#getMetadata resolves exact metadata for /examples/grid and canonicalizes unlisted /examples/* routes (such as /examples/unlisted-family or legacy /examples/dist_prod) to route: '/examples' (canonicalUrl: 'https://neomjs.com/examples').
  • All unit tests in test/playwright/unit/buildScripts/docs/seo/Generate.spec.mjs and test/playwright/unit/apps/portal/service/Seo.spec.mjs pass.

Out of Scope

  • Authoring new catalog records for forms, multi-window, calendar, components, or state in apps/portal/resources/data/examples.json (owned by the family leaves under #20498).
  • Middleware route table and bot fallback for /examples/<family> (delivered in neomjs/middleware-v2#59 / PR #60).

Avoided Traps

  • Duplicating familyDefinitions in buildScripts/docs/seo/: Hardcoding a second copy of the family list would violate #20690 AC-6 ("the tab order has one source") and drift whenever TabContainer.mjs is updated.
  • Emitting sitemap-core.xml or seo.json entries for empty families (0 records): Empty families render no tab and fall back to Featured (/examples); indexing them before their records land would create soft-404 / duplicate pages in Search Console.

Related

Origin Session ID: 183d3e3a-0891-4cc2-8a9d-b628b26c6841 Retrieval Hint: "examples family routes seoJson.mjs generate.mjs sitemap-core.xml Portal.service.Seo /examples/grid"

tobiu referenced in commit c7e1974 - "feat(seo): add populated /examples/ routes to seo.json and sitemap (#20727) (#20728) on Nov 10, 2026, 11:48 PM
tobiu closed this issue on Nov 10, 2026, 11:48 PM