LearnNewsExamplesConnect
Frontmatter
assigneesneo-gemini-julia
createdAtNov 10, 2026, 2:45 AM
updatedAtNov 10, 2026, 4:47 AM
githubUrlhttps://github.com/neomjs/neo/issues/20688
authorneo-gemini-julia
commentsCount0
parentIssue20671
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 10, 2026, 4:47 AM

Route-specific seo.json, canonical URL, and ld+json for deep Portal routes

Closed v14.0.0/archive-v14-0-0-chunk-1 enhancementaibuildportal
neo-gemini-julia
neo-gemini-julia commented on Nov 10, 2026, 2:45 AM

Context

Parent epic: #20671 (Search engines and agents find and classify neomjs.com, Engine 13.5 cornerstone 4 in ROADMAP.md).

When a user or coding agent navigates to any deep route in the Portal browser shell (/learn/*, /news/blog/*, /news/releases/*), Portal.view.ViewportController#onHashChange (apps/portal/view/ViewportController.mjs:230-236) delegates <head> updates to Portal.service.Seo#onRouteChanged (apps/portal/service/Seo.mjs:127-130). Crawler snapshots (Googlebot / LLM bots) are built separately by neomjs/middleware-v2 (SsrService#buildHeadInjection) from the rendered body and apps/portal/index.html; wiring SsrService#buildHeadInjection to consume apps/portal/resources/data/seo.json is tracked in #20700 under #20671.

The Problem

Measured on dev at 62f75736ba:

  1. apps/portal/resources/data/seo.json contains only 10 top-level routes (/about-us, /docs, /examples, /home, /learn, /news, /news/blog, /news/releases, /news/videos, /services).
  2. Every deep route falls back to generic parent metadata (#8439 stopgap):
    • Portal.service.Seo#getMetadata(route) (apps/portal/service/Seo.mjs:72-95) pops path segments until it matches a top-level prefix.
    • As a result, all /learn/* guides render in the browser shell with the identical <title>Learn Neo.mjs</title> and <meta name="description" content="Learn the fundamentals of the Neo.mjs platform.">; all /news/blog/* articles render with <title>Neo.mjs Blog</title>; and all /news/releases/* notes render with <title>Neo.mjs Releases</title>.
  3. Portal.service.Seo never sets <link rel="canonical">, OpenGraph route metadata, or route-specific ld+json:
    • Portal.service.Seo#updateDocumentHead (apps/portal/service/Seo.mjs:142-145) only passes {description, title, windowId} to DocumentHead.update.
    • apps/portal/index.html:9-13 hardcodes <meta property="og:title" content="Neo.mjs - An Agent Institution">, <meta property="og:description" ...>, and <meta property="og:url" content="https://neomjs.com/">, which stay frozen on /home across all route transitions, and no <link rel="canonical"> tag is emitted.
    • In src/main/addon/DocumentHead.mjs:246-254, update({ldJson}) calls me.setLdJson({value: ldJson}) without forwarding name, which selects the first script[type="application/ld+json"] in <head> and overwrites the root data-schema-name="neo-organism" graph (apps/portal/index.html:15).

The Architectural Reality

  • buildScripts/docs/seo/generate.mjs and buildScripts/docs/rebuildContentIndexesAndSeo.mjs already walk learn/tree.json, apps/portal/resources/data/blog.json, and apps/portal/resources/data/releases.json for sitemap-core.xml and llms*.txt, but do not generate or synchronize apps/portal/resources/data/seo.json.
  • Neo.main.addon.DocumentHead (src/main/addon/DocumentHead.mjs) already exposes setCanonical({url}), setDescription({value}), setTitle({value}), setTag({value}), and named setLdJson({name, value}) (script[type="application/ld+json"][data-schema-name="..."]).
  • test/playwright/e2e/portal/ConnectNL.spec.mjs asserts the /services entry in apps/portal/resources/data/seo.json, so the 10 curated top-level entries must be preserved directly from apps/portal/resources/data/seo.json as their single source of truth when deep-route entries are generated.

Design authority: #20671 (ROADMAP.md Engine 13.5 cornerstone 4: "every canonical Portal route serves route-specific SSR metadata, structured schema and clean semantic HTML").

The Fix

  1. Extract route-specific titles and descriptions in buildScripts/docs/seo/seoJson.mjs (getSeoJson / --format seo-json) and wire into buildScripts/docs/rebuildContentIndexesAndSeo.mjs:
    • Preserve the 10 curated top-level entries directly from apps/portal/resources/data/seo.json (no duplicate hardcoded map in build scripts).
    • Generate deterministic route-specific {title, description, schemaType} entries for every leaf in learn/tree.json (/learn/<id>), every blog post in apps/portal/resources/data/blog.json (/news/blog/<slug>), and every release note in apps/portal/resources/data/releases.json (/news/releases/<version>), extracting the H1/node title and the first non-heading summary paragraph from each Markdown file (capped cleanly to meta-description length ~155–160 chars), and regenerate seo.json inside rebuildContentIndexesAndSeo.mjs.
  2. Preserve named ld+json schemas and support tags arrays in Neo.main.addon.DocumentHead#update (src/main/addon/DocumentHead.mjs):
    • Allow update({ldJson, tags}) to accept tags: Object[] (forwarded to setTag({value})) and unambiguous {name, value} wrappers (!('@context' in ldJson) && !('@type' in ldJson)) so route-level structured data writes to or clears (value: null) <script type="application/ld+json" data-schema-name="neo-route"> without clobbering <script type="application/ld+json" data-schema-name="neo-organism"> or misclassifying plain Schema.org objects that happen to carry name and value.
  3. Update Portal.service.Seo (apps/portal/service/Seo.mjs) to synchronize canonical URL, OpenGraph tags, and route ld+json:
    • Normalize incoming hashString (/learn/..., /news/blog/..., /news/releases/...), normalize /home (and /) canonicalUrl and og:url to 'https://neomjs.com/', resolve route metadata via getMetadata(route), update <title>, <meta name="description">, <link rel="canonical">, og:title, og:description, og:url, and emit <script type="application/ld+json" data-schema-name="neo-route"> (TechArticle / BlogPosting / WebPage) only for exact routes in seo.json while clearing neo-route (value: null) on parent-segment fallback hits.

Contract Ledger

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
buildScripts/docs/seo/seoJson.mjs, generate.mjs, rebuildContentIndexesAndSeo.mjs (getSeoJson, --format seo-json) #20671 Preserves curated top-level entries directly from apps/portal/resources/data/seo.json, generates route-specific {title, description, schemaType} entries for /learn/*, /news/blog/*, and /news/releases/*, and regenerates seo.json in rebuildContentIndexesAndSeo.mjs Falls back to node name and parent description if a Markdown file has no body paragraph JSDoc in seoJson.mjs, generate.mjs, rebuildContentIndexesAndSeo.mjs test/playwright/unit/buildScripts/docs/seo/Generate.spec.mjs, test/playwright/unit/buildScripts/docs/rebuildContentIndexesAndSeo.spec.mjs
Neo.main.addon.DocumentHead#update(data) (src/main/addon/DocumentHead.mjs) DocumentHead#setLdJson, DocumentHead#setTag Forwards tags: Object[] to setTag({value}) and treats ldJson as a named {name, value} wrapper only when !('@context' in ldJson) && !('@type' in ldJson) (with value: null removing the named script) so named route schemas do not overwrite data-schema-name="neo-organism" Plain ldJson object (including Schema.org PropertyValue with name/value) writes to the default selector JSDoc in DocumentHead.mjs test/playwright/unit/main/addon/DocumentHead.spec.mjs
Portal.service.Seo (apps/portal/service/Seo.mjs) #20671 Updates title, description, canonicalUrl (https://neomjs.com/ for /home and /, https://neomjs.com<route> otherwise), og:title, og:description, og:url, and data-schema-name="neo-route" ld+json on exact route matches while clearing neo-route (value: null) on parent-segment fallback hits Parent-segment fallback in getMetadata(route) remains for unlisted sub-routes without lending parent title to ldJson headline JSDoc in Seo.mjs test/playwright/unit/apps/portal/service/Seo.spec.mjs + ConnectNL.spec.mjs

Decision Record impact: none.

Acceptance Criteria

  • buildScripts/docs/seo/generate.mjs exports getSeoJson() (and supports --format seo-json, wired into rebuildContentIndexesAndSeo.mjs), populating apps/portal/resources/data/seo.json with route-specific title and description entries for all learn/tree.json leaves (/learn/*), blog.json leaves (/news/blog/*), and releases.json leaves (/news/releases/*) while preserving all 10 curated top-level routes directly from apps/portal/resources/data/seo.json.
  • Neo.main.addon.DocumentHead#update supports tags: Object[] and unambiguous named ldJson wrappers ({name: 'neo-route', value: ...} or value: null) without overwriting <script type="application/ld+json" data-schema-name="neo-organism"> or misclassifying plain Schema.org objects.
  • Portal.service.Seo updates title, description, canonicalUrl (https://neomjs.com/ for /home, https://neomjs.com<route> otherwise), og:title, og:description, og:url, and data-schema-name="neo-route" ld+json on exact route matches (clearing neo-route on fallback routes).
  • Unit tests in test/playwright/unit/buildScripts/docs/seo/Generate.spec.mjs, test/playwright/unit/buildScripts/docs/rebuildContentIndexesAndSeo.spec.mjs, test/playwright/unit/main/addon/DocumentHead.spec.mjs, and test/playwright/unit/apps/portal/service/Seo.spec.mjs verify all contracts.

Out of Scope

  • Wiring neomjs/middleware-v2 (SsrService#buildHeadInjection) to read apps/portal/resources/data/seo.json for crawler snapshots (#20700 under #20671).
  • Example overview routes (/examples/* family pages under #20498), which will be added once their route structure lands.
  • Middleware SSR cache invalidation on the build host (neomjs/middleware-v2#55).

Avoided Traps

  • Adding 19,400+ archive routes (/news/tickets/*, /news/pulls/*, /news/discussions/*) to seo.json: That would bloat seo.json into a multi-megabyte runtime fetch on Portal boot. seo.json stays scoped to the curated core routes (sitemap-core.xml scope).
  • Duplicating curated top-level metadata in build scripts: apps/portal/resources/data/seo.json is the single source of truth for curated top-level routes; getSeoJson() reads and preserves them directly from seo.json.
  • Calling DocumentHead#setLdJson without name: Overwrites the root data-schema-name="neo-organism" graph in apps/portal/index.html.

Related

Parent: #20671 · Follow-up: #20700 (middleware-v2 SsrService#buildHeadInjection wiring) · Related: #20677 (PR #20684, /services line in seo.json) · #8439 · #7772 · #7777

Live latest-open + closed sweep: checked all 13 open issues in neomjs/neo (#19058–#20687) plus closed search (seo.json OR Portal.service.Seo OR DocumentHead, read #8439, #7772, #7777, #20677) at 2026-11-10T01:43Z; no open equivalent or prior exclusion found (#8439 added the parent-path fallback when seo.json had only top-level routes). Backlog: 13 open, green band. A2A in-flight claim sweep: latest 30 messages, all read-states, at 01:43Z; no competing claim on Portal.service.Seo or seo.json. MC sweep: query_raw_memories on "Portal.service.Seo seo.json DocumentHead deep routes learn blog releases generic title description", 6 results; no conflicting decision found. Own-assignment sweep: 1 open in neomjs/neo (#20671, parent epic). Structure map: N/A (ai:structure-map is Brain-hosted; modifies existing buildScripts/docs/seo/generate.mjs, apps/portal/service/Seo.mjs, apps/portal/resources/data/seo.json, and src/main/addon/DocumentHead.mjs).

Owner: self-assigned at creation as steward of #20671.

Origin Session ID: 132c8467-16c8-4c19-ab83-24c483477a21

Retrieval Hint: "Portal.service.Seo seo.json deep routes learn blog releases canonicalUrl ldJson"

tobiu referenced in commit 3b4ccd0 - "feat(portal): add route-specific seo.json, canonical URL, and ld+json for deep routes (#20688) (#20689) on Nov 10, 2026, 4:47 AM
tobiu closed this issue on Nov 10, 2026, 4:47 AM