Skip to content

feat(seo): share metadata and JSON-LD at parity with the old site - #282

Merged
sydevs-bot merged 37 commits into
mainfrom
claude/feat-273-seo-parity
Nov 20, 2026
Merged

sydevs-bot merged 37 commits into
mainfrom
claude/feat-273-seo-parity

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Every content route serves the Open Graph, Twitter and JSON-LD a share and a rich result need. Only /map carried any before.
  • Unhead generates that head on the server, behind data.seo, so the @graph is one set of linked nodes instead of a flat list.
  • A pasted meditation or lecture URL now renders as a player, through a new GET /oembed and a player card.
  • The site identifies itself to a device: a manifest, a home-screen icon, theme-color, and the App Store banner.
  • /map publishes through that same generator, so the site has one head mechanism rather than one plus an exception.
  • Joined: documentEmbedHref and lib/embed-player.ts fold the /embed suffix and the iframe geometry that three surfaces were about to spell separately.

Change outline

The head was two mechanisms at two levels. It is now one document, built where the content is, generated once per request on the server.

Flow — how a content route's head is built

 pages/[slug]/+data.ts · meditations/[id]/(full) · lectures/[id]/(full)
   read the document from SahajCloud
   pageSeo / meditationSeo / lectureSeo            lib/content-seo.ts
     title        <name> | We Meditate             # home: We Meditate | <tagline>
     canonical    localeUrl(origin, locale, path)  # also og:url and every node's url
     alternates   buildAlternates(…)               lib/hreflang.ts, unchanged
     meta         og:* · twitter:* · robots · apple-itunes-app · article:* · og:image:*
+    links        <link rel=alternate type=application/json+oembed>   # media routes only
-    jsonLd       serializeJsonLd([Organization, WebSite, …])   # schema-dts, hand-written
+    schema       { site, inLanguage, nodes: SeoNode[] }        # plain data, lib/seo-schema.ts
   → data.seo

 pages/+config.ts                                  # once for the site, not per route
-  Head: ContentHead                               lib/head.tsx
-    SeoHeadTags(data.seo)                         # a React component, client bundle too
+  headHtmlEnd: seoHeadHtml                        lib/seo-head-html.ts
+    # vike-react's setting is global as well as cumulative: one declaration
+    # per route rendered the whole head once per declaration, on every page
+    createHead({ disableDefaults, plugins: [UnheadSchemaOrg({ host })] })
+      disableDefaults  # else a second charset, viewport and <html lang>
+    pushHead      canonical · hreflang · meta · links
+    pushSchemaOrg Organization · WebSite · the route's own nodes
+    head.render().headTags                        # synchronous on the server
+    '' under a live preview, '' for a route that built no document
+    # so building the document in +data.ts is a route's whole opt-in
   title: contentTitle · description: contentDescription    lib/head-settings.ts

Contract — one new public endpoint, and one new document

 GET /oembed?url=<media url>[&maxwidth&maxheight&format]      server/oembed/routes.ts
+  200  the oEmbed 1.0 `video` shape: html (the iframe), width, height,
+       provider_name, provider_url, title?, thumbnail_url?
+  404  every URL that is not /meditations/:id or /lectures/:id ON THIS ORIGIN,
+       and every document the read cannot find
+  501  format=xml, which the spec reserves for a format a provider lacks
+  maxwidth/maxheight cap the player, keep its ratio, and never scale it up

 GET /manifest.webmanifest  ·  GET /:locale/manifest.webmanifest
+  200  application/manifest+json, named from the translations, display: browser

Behaviour — what the graph claims, and what it refuses to

 Organization ──publisher── WebSite ──isPartOf── WebPage ──mainEntity── Audio/VideoObject
                                                     │                      ↑ @id minted here
                                                     └── BreadcrumbList · ItemList · Question
+  every node carries @id and inLanguage
+  an image is hoisted to its own ImageObject, with width, height and caption

 pageSeo(page)
+  isArticle → Article: datePublished, dateModified, Person byline, Organization publisher
+              + article:published_time · article:modified_time · article:author
+  an accordion of question/answer items → @type ['WebPage','FAQPage'] + one Question each
+  a songs content-index block → MusicPlaylist of MusicRecording
+    byArtist ← the album's artist, its url gated by isSafeHttpUrl
+    duration ← the song's own, omitted where SahajCloud stores none
-  @type read off the slug: /about → AboutPage          # Unhead's inference, pinned off
-  primaryImageOfPage ← the Organization logo           # Unhead's fallback, pinned off

 og:image, where the upload reported its own geometry
+  og:image:width  ← the variant's width
+  og:image:height ← the SOURCE's ratio at that width   # a flexible variant sets width only
+  og:image:alt · twitter:image:alt ← the editor's alt text
+  nothing at all for a source narrower than the render # upscaling is unverified
+  the site default states its own 1200×630, because the asset is ours

 robots
+  max-image-preview:large  on the real site
+  noindex                  on a preview Worker, a dev host, and both embed routes

Files — what each new module owns

 lib/
   head.tsx           # SeoHead/SeoDocument, isOpenGraphKey, isSafeJsonLd, NoIndexHead.
                      #   `ContentHead` and the hand-rolled `SeoHeadTags`/`HreflangLinks`
                      #   renderer are both gone: one generator renders every head
+  atlas-seo.ts       # /map's answer as the same SeoDocument. Replaces lib/atlas-head.tsx
+  seo-schema.ts      # the @graph as plain, serializable descriptors
+  seo-head-html.ts   # the generator: descriptors → head HTML. Server-only, vike's headHtmlEnd
+  embed-player.ts    # the iframe and its geometry, which three surfaces must agree on
+  app-identity.ts    # the store ids, the theme colour, the home-screen icon
   structured-data.ts # was eight schema-dts builders. Now isoDuration alone; the
                      #   serializer went with /map's component head, and so did schema-dts
   document-routes.ts # + documentEmbedHref(), the `/embed` suffix LectureTemplate hand-rolled
   content-blocks.ts  # contentIndexBlocks generalized to contentBlocks(content, blockType)
   cloudflare-images.ts # + getVariantWidth(), so og:image:width is not a second literal
 public/images/metadata/
+  share.png          # 1200×630, the ratio every consumer crops to
+  icon.png           # 1024×1024, the lotus mark alone. preview.png served both and fitted neither
 server/
+  oembed/index.ts    # resolveOEmbedTarget + buildOEmbedResponse. Reads nothing
+  oembed/routes.ts   # the one read and the status codes
+  manifest.ts        # buildWebManifest
   sitemap-routes.ts  # + the two /manifest.webmanifest routes, beside robots.txt and sitemap.xml

Contract — the page read gains two fields

 PAGE_SELECT                                       server/sahajcloud-client.ts
   title · content · slug · createdAt · _status · author · featuredVideo · meta · tags
+  updatedAt     # Article.dateModified, and article:modified_time

 AUTHOR_POPULATE
   name · title · slug · countryCode · yearsMeditating · photo
+  description   # the Person node an article's byline publishes

Preview

Deployed: https://claude-feat-273-seo-parity-wemeditate-web.contact-c66.workers.dev. What to look at there:

  • / — the site-title form, the default share image as og:image, robots noindex (a preview is not the real site). curl -s <preview>/ | grep -c 'rel="canonical"' prints 1; on c221df7 it printed 3
  • /kundalini-bandhan (an article: it carries a tag) — og:type article, Article with both dates, article:*
  • /kundalini (the knowledge menu lists it) — BreadcrumbList, and a WebPage with no primaryImageOfPage, because that page has none of its own
  • /inspiration — ItemList of the cards the page server-rendered
  • A class page — @type ['WebPage','FAQPage'] with one Question per accordion item
  • /meditations/142 and /lectures/163 — twitter:card player, og:video, the oEmbed <link>, AudioObject / VideoObject named as the page's mainEntity
  • /oembed?url=<preview>/lectures/163 — the player JSON. ?url=https://evil.test/ answers 404
  • /map — one canonical, one @graph, both now from the same generator. The canonical is the atlas document's own webUrl, which is a wemeditate.com URL even on the preview, by design
  • /fr/manifest.webmanifest — the manifest, in French
  • /meditations/142/embed — no canonical, no og:url, no JSON-LD, and robots noindex

The Ladle preview builds (its trigger includes lib/* and public/*) but shows nothing of this change.

Test results

  • Lean gate: ✓ .claude/skills/pr-prep/check.sh — eslint 0 errors, tsc --noEmit clean, 1572 tests
  • Targeted specs: lib/content-seo.test.ts 64, lib/seo-head-html.test.ts 25, server/oembed/index.test.ts 21, tests/guards/content-head.test.tsx 14, lib/atlas-seo.test.ts 12, lib/head.test.tsx 11, server/oembed/routes.test.ts 8, pages/head.test.tsx 7, lib/structured-data.test.ts 7, server/manifest.test.ts 4
  • Build: ✓ pnpm build. Worker bundle +103 KB raw, +27 KB gzipped on the server build (3180 → 3283 KB raw, 808 → 835 KB gzipped); the client build is unchanged at 2351 KB, which is the point of generating server-side. The /map conversion moved its head out of the client bundle too
  • Security review: ✓ no findings. The diff touches server/ and adds a public endpoint, so the sweep ran over the whole branch, and again over each push since. The latest sweep probed the new locale strip on /oembed with a hostile corpus — a double prefix, %2F and %66r escapes, //, a backslash, dot-segments, non-ASCII homoglyphs and __proto__ — and every one is refused; the origin comparison still runs before anything else touches the URL, and the matched id cannot escape the iframe's quoted src, because the WHATWG path encode set covers ", <, > and space. An earlier sweep read Unhead's compiled sanitizer for the JSON-LD sink and rendered the real /map path with a hostile atlas answer — a quote breakout in og:image, a breakout in a meta key, a "><script> hreflang and a <img onerror> inside the graph. jsdom parsed nine head elements, one script, no executable script and no injected node, and the graph round-tripped unchanged

The smoke lane is what proves the generator runs in the Worker: nothing in the unit lane executes a vike headHtmlEnd hook, and nothing but the preview routes /oembed ahead of the page catch-all. Six new smoke specs cover that, the linked graph, /map, the manifest, and the tag-duplication check.

Manual verification

  1. Paste one lecture URL into a WordPress post, or a Discourse topic, and confirm the player renders rather than a link.
  2. Run one article URL through a Twitter card validator and confirm the image, title and alt text render.
  3. Add the site to an iOS and an Android home screen and confirm the icon and the browser chrome colour.

Notes for reviewer

  • The spike held, and the first claim I made about it was wrong on the deployed Worker. disableDefaults does stop a second <title>, charset and viewport, and that is what the smoke spec counted. What no spec counted was the generated head itself: vike-react declares headHtmlEnd global as well as cumulative, so the three route declarations each ran on every page, and the preview served three canonicals, three robots metas and three @graph blocks on /, on /:slug and on both media routes. The declaration now lives in pages/+config.ts alone, the source guard asserts there is exactly one, and the smoke spec counts the canonical, og:url and the JSON-LD block as well. Nothing else moved: the hook already returned '' for a route carrying no seo.schema, which is why /map and the embed routes were bare on that same preview while receiving all three calls. head.render() is synchronous on the server, so the hook matches vike-react's HtmlInjection type with no cast.
  • Smoke (web) was red on c221df7 for a second reason, and that is why the above shipped unseen. Preview discovery read the first workers.dev host in Cloudflare's comment, which Cloudflare rewrites in place: between the push and that build finishing it still named b60f0ac and carried b60f0ac's address. The lane measured the build before the one on trial — five specs failed on routes c221df7 adds, and the two specs that would have counted the head passed over markup that predated it. Discovery now reads the comment's Latest Commit cell and waits for this commit's own build.
  • Three claims Unhead makes that this repo must not. @type on a WebPage is inferred from the slug, so /about would publish AboutPage — the exact claim the ticket left out, because a slug is the editor's to change. primaryImageOfPage falls back to the Organization logo. defineVideo substitutes the literal No description. All three are pinned off, and each has a test.
  • VideoObject.uploadDate is still not emitted, and this is a data gap, not a choice. LectureMetadata carries title, thumbnailUrl, hlsUrl, duration, subtitles and lastSyncedAt — no publish date. lastSyncedAt is when we read the lecture. The lecture document's own createdAt is when it was created here, not when the talk was given, so neither is the date Google asks for. It needs an upstream field in sydevs/SahajCloud first; the criterion is on the ticket and I have not ticked it.
  • og:image:height is derived, and omitted where it cannot be. A Cloudflare flexible variant constrains the width alone, so the height is the source's ratio at that width. Whether width=1024 upscales a narrower source is unverified, so a source under the variant width states no geometry at all rather than one of two possible answers.
  • One group of §2 is still not built: SoftwareApplication for /app. It stays blocked — /app does not exist yet, and Switch wemeditate.com over to the new site #160 owns it, so its node cannot be verified on a preview. The criterion stays on feat(seo): share metadata and JSON-LD at parity with the old site #273. (defineSoftwareApp exists in the library, so that node is a helper call when /app lands.)
  • MusicPlaylist is built, and has no preview URL to be checked on. A songs content-index block already resolves to the tracks MusicLibrary plays, so the descriptors read that same list rather than taking a second read. No published page carries such a block today — /music, /songs and /meditation-music all 404 on the preview — so a smoke spec would assert nothing. The three unit cases render the real generator instead. A recording carries no inLanguage: the page's locale is the language of the track's name, not of a recording that may be instrumental.
  • schema-dts and serializeJsonLd are both gone. The serializer's last caller was /map's component head, so converting that route left it with none, and the devDependency with no importer in any file. Both removed; say the word and they come back.
  • The robots spelling fixed a latent bug. The renderer sent everything but twitter: to property=, so robots would have shipped as a property meta, which no crawler reads. isOpenGraphKey inverts it to the real rule.
  • The JSON-LD escaping is now the library's, and it was checked rather than assumed. The hand-written serializer escaped every < and isSafeJsonLd was the belt to that braces. The generated block no longer passes that guard, so the security sweep ran the real renderSeoHead with a script-closing payload and an attribute-breaking payload planted in fourteen SahajCloud-authored fields: every quote came back as an entity and every < inside the script came back escaped. Unhead does it in two layers, sanitizeTagsInPlace and tagToString. isSafeJsonLd still gates the one remaining pre-serialized block, /map's.
  • One non-security gap the sweep noted: /oembed reads a title in whatever locale the consumer's URL names, without the availableLocales filter the page routes apply. It is published translation text either way, so it serves a language the site does not currently offer rather than anything private. Say if you want the filter.
  • A smoke helper was asserting nothing. Its JSON-LD pattern was anchored on the closing quote of application/ld+json; Unhead's block carries a data-hid attribute after it, so every assertion over a generated graph would have passed vacuously.
  • The fallback share card stated no geometry at all. og:image:width and og:image:height travelled with the page's own image, so the 59 of 66 pages that fall back to the site default published a bare og:image. The asset is in this repository, so its pixels are known: the card now states them, and shareImage answers the whole image rather than a URL, which puts the geometry beside the og:image it belongs to instead of in each caller's extra meta. The fallback still carries no og:image:alt — alt text is a visitor-facing string, and every one of those is SahajCloud's, so that needs an upstream key first.
  • The share card and the app icon are now two assets, at your word on the preview.png thread. One square file served both slots and fitted neither: a 1.91:1 consumer centre-cropped it, so the uncropped half was margin that read as an empty white card at feed size, and a home screen drew the wordmark at 48px. share.png is 1200×630 — the shipped lockup recomposed at the ratio every consumer crops to, filling 58% of the frame. icon.png is 1024×1024, the lotus mark alone, from the vector LogoSvg draws; its ink spans 70% of the canvas, inside the maskable safe zone, so the manifest declares any maskable from one file. Both are recompositions of the existing brand asset, not new artwork — a designer replaces either file with no code change. tests/_helpers/png.ts reads each file's IHDR, so neither stated geometry can drift from its file.
  • pageContextT moved to lib/i18n.ts, beside getT. It was the long-term answer you asked for on the useT thread: hooks/ now holds only hooks, and lib/head-settings.ts — the half of the head that ships to the browser — no longer reaches through a hook module for a plain function.
  • server/oembed/ is the first subfolder in server/. The flat pair it replaces matched sitemap.ts / sitemap-routes.ts, which is still flat. Say the word and the same grouping goes to sitemap and atlas, or this one goes back.
  • No other library does this end to end, and the one in use covers more than I thought. next-seo is React components peer-depending on next, one <script> per type and no linked graph; react-schemaorg is schema-dts plus React, which mints no @id — the thing we removed; unschema-graph is not published to npm. @unhead/schema-org is the only maintained library that assembles a linked @graph server-side. What no library can own is the step before it: SahajCloud's document shapes are this site's, so the mapping onto schema.org nodes is the content model. Of lib/seo-head-html.ts's 381 lines, 140 are comments and 109 are that mapping. But one claim in it was simply wrong: defineMusicPlaylist, defineMusicRecording and defineMusicGroup all ship in 3.4.3. They stay unused for a reason the comment now states — track is typed NodeRelations<string>, so a nested recording needs a cast, though the resolvers render the nested form correctly (checked). What the hand-rolled node was really missing was its @id, which the rest of the graph carries and it did not. Fixed.
  • The merge with fix(pages): a prefix that is not a language 404s instead of serving a second address #315 was clean and still broke two specs, which is the semantic-conflict case worth recording. fix(pages): a prefix that is not a language 404s instead of serving a second address #315 made the document route matchers take a bare path: Vike strips a real locale before a route function runs, so a prefix that still arrives is not a language, and tolerating one served /zz/lectures/163 as a second address. /oembed is a Hono route where nothing stripped anything, so it had been relying on exactly that tolerance to resolve /fr/lectures/163. Both intents stand: the endpoint now strips the locale itself through localeFromPath, which leaves an undefined code in place, so a media path under one is refused here too. The locale rides on the resolved target rather than being parsed a second time in the handler. The smoke lane had reached /oembed only through a bare /lectures/:id, so no spec sent it a prefixed URL at all — the refusal half, which needs no particular language published, is now pinned there.
  • Dismissed from the earlier review pass, with reasons: meditationSeo/lectureSeo were proposed for merging into one mediaSeo — they differ in page type, name fallback, duration source and node type; contentTitle/contentDescription were proposed for a shared factory — vike needs two exported names; the claim that vike-react's image setting can see pageContext.data is wrong, and tsc says so. An ItemList entry was called a leak of a meditation's internal label — ContentCard already prints that same string in an <h3> on the same indexable page.
Detail

Why the document is still built in +data.ts. title and description are vike-react settings, read by a plain (pageContext) => string where no hook may run, and re-applied on client-side navigation, which no head hook gets to do. So the only place both halves can read one answer is pageContext.data. The generator then reads the same document from pageContext inside headHtmlEnd, which is why the rendered string never rides data and never reaches the browser.

Why the descriptors are plain data rather than Unhead's own inputs. define* returns an object carrying a _resolver, and some resolvers hold functions. Putting those on data would mean serializing them. The descriptors (lib/seo-schema.ts) are the serializable half: a route says which nodes and what each claims, and the generator — server-only — knows how one is spelled. It is the same seam content-seo.ts / structured-data.ts had, with the spelling half moved behind the library.

What pushHead and pushSchemaOrg are. Unhead's useHead and useSchemaOrg, aliased. They take the head instance explicitly and are not React hooks, but @eslint-react/rules-of-hooks reads the use prefix and errors — and keeping the prefix here would read as the component-level head hook this repo forbids, which is the opposite of what a server-only generator is.

What replaced schema-dts's compile-time check. The eight hand-written builders made a misspelled @type a compile error. Unhead's define* helpers are typed against their own node types, which catches the same class of mistake at the same moment; what is lost is the type check on a plain node, and there are exactly two — AudioObject, because @unhead/schema-org ships no defineAudio, and MusicPlaylist, whose helper exists but types track as a string or an @id reference.

Why the FAQ link is Unhead's and not ours. The first attempt listed every Question in the WebPage's mainEntity as well as typing the page FAQPage. Unhead writes that link itself once the type says FAQPage, so each question appeared twice. The ids are still minted from the canonical (#question-1), so they are stable per URL rather than Unhead's positional #/schema/question/N.

The /oembed refusal, and why it checks the origin. The url parameter is whatever a caller sends. resolveOEmbedTarget parses it, compares parsed.origin to the serving origin, and only then strips a locale and matches the path against matchDocumentRoute for the two embeddable collections. Without the origin check, anyone could point a consumer at a media path on their own host and have us answer for their page. A locale-prefixed URL resolves, and the player it answers with keeps that locale; a prefix SahajCloud does not define is a path segment, so it is refused. An /embed URL does not resolve either: the embed route is the player, not a page with one.

Why the manifest is a route. public/ is copied by the Vike build and the Ladle build alike, so a manifest.webmanifest there would also claim to be the playground's. Being a route also lets it answer in the language of the URL, which a static file cannot — hence the locale-prefixed link in the head and both spellings registered. Its names come from the translations, so there is no literal in it.

Measured, not assumed. Every library behaviour above was checked against the compiled source in node_modules, or by rendering: that head.render() is synchronous, that disableDefaults suppresses charset/viewport/lang, that defineVideo fills description, that defineWebPage reads a subtype off the URL, that Unhead links Question into FAQPage.mainEntity, that the data-hid attribute defeats the old smoke pattern, and that a nested defineMusicRecording renders without leaking its _resolver.

Each new behaviour was watched failing. Removing disableDefaults, the robots line, the article dates, the player tags, the oEmbed origin check, the @type pin, the FAQ filter and the geometry guard each turn at least one test red; so does deleting the seo: line from a route's +data.ts, which the guard's source half catches.

/map now publishes through the same generator, which is the last thing that made "one head mechanism" untrue. lib/atlas-seo.ts adapts the endpoint's answer into the SeoDocument every other route builds; lib/atlas-head.tsx, SeoHeadTags, HreflangLinks and the cumulative-Head workaround are gone with it. Its @graph still arrives already serialized — upstream mints the ids — so the generator takes a pre-serialized block as well as descriptors, and isSafeJsonLd still gates that one. Two claims moved with it: <title> and the description became vike-react's settings read off the document, and /map gained the robots meta the rest of the site carries.

Closes #273

🤖 Written by the sydevs autonomous loop — see what this is

https://claude.ai/code/session_01Mg9rjYYJDYBFAnWH6C4PjD

The head was two mechanisms: `usePageHead` set title/description/image
from inside PageTemplate, and `Head: ContentHead` emitted the canonical
and the hreflang cluster from the route. A template is shared with the
embed routes and the live preview, so it is the wrong level for either.

Each content route's `+data.ts` now builds a `SeoDocument` where the
document is already in hand, and one renderer emits it — the same
renderer `/map` reaches through `lib/atlas-head.tsx`, so the site has
one head shape. `pages/+config.ts` declares `title` and `description`
once for every route; a route with no document of its own falls back to
the site's name and description in the locale of the URL.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVDpddapWkWg3qEMdV
Every content URL now serves the Open Graph and Twitter properties
vike-react does not generate, and a JSON-LD @graph describing it:
Organization and WebSite everywhere, WebPage and Article for a page,
BreadcrumbList under the knowledge menu, ItemList for a content index,
AudioObject for a meditation, VideoObject for a lecture.

`schema-dts` types every node, so a property schema.org does not define
is a compile error rather than markup a validator rejects after deploy.
A page with no image of its own shares the old site's own preview.png,
which 59 of 66 production pages need.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVDpddapWkWg3qEMdV
The WebSite node carried whichever description the page had, so a crawler
read one article's summary as the whole site's. It now carries the site's
own description, which is what the node claims.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVDpddapWkWg3qEMdV
Found by the review pass over the branch:

- The JSON-LD carried the default share image as the page's own, so 59 of
  66 pages would have claimed the site preview as their article picture.
  `og:image` keeps the default — a link with no preview is worse than a
  generic one — and the nodes now carry the document's own or nothing.
- A lecture's poster skipped the share variant and the origin, so the
  `VideoObject` could name a relative URL where a meditation named an
  absolute one.
- `og:locale` spelled `pt-BR`, which Open Graph reads as `pt_BR`. Only the
  separator changes: nothing upstream stores a territory for a bare `en`.
- `twitter:*` rode `property=`, while vike-react emits `name="twitter:card"`
  for `/map`. One tag had two spellings on one site.

`absoluteHref` and `isKnowledgePage` move the two derivations this branch
would otherwise have copied into their existing owners, which also removes
the hand-rolled pair in `EmbedButton`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVDpddapWkWg3qEMdV

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 question for the reviewer, one per thread.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread lib/head.tsx Resolved
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot

sydevs-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running
CI fix 1

recent dispatches
  • 00:48Z resolve-conflicts · attempt 1 · session · done
  • 00:48Z resolve-conflicts · attempt 1 · session
  • 00:24Z address-review · attempt 1 · session · done
  • 00:24Z address-review · attempt 1 · session
  • 23:54Z resolve-conflicts · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 18, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

One SeoDocument per route, built where the content is, rendered once — the ticket's shape. Taking the head out of the shared templates is the right fix for the embed and live-preview hazard, and the cluster, og:locale:alternate and the sitemap now read one derivation. Each joined change removes a duplicate this branch would have created.

One ticket error worth recording: §2 says og:url follows "the canonical's host rule: isIndexableHost decides". The canonical has never been gated — isIndexableHost has one caller, server/sitemap-routes.ts:183. The ungated og:url matches existing behaviour, so that open question needs no change.

Findings

  • should-fix — lib/content-seo.ts:244: an ItemList entry can publish a meditation's internal admin label.
  • consider — lib/structured-data.ts:67: eight single-caller builders; the rule centralising them is written 12 times.
  • consider — lib/content-seo.ts:335: the home page's WebPage.name still claims Home Page.

What was checked

Read whole: content-seo.ts, structured-data.ts, head.tsx, head-settings.ts, site-identity.ts, atlas-head.tsx, the three +data.ts, content-index.ts, content-blocks.ts, urls.ts.

Ladder walked on every new piece. Held: site-identity.ts has two consumers and stops the footer and sameAs drifting; absoluteHref, isKnowledgePage, lecturePlaybackSeconds and contentIndexBlocks each fold an existing duplicate into its owner; schema-dts is types-only.

Verified: both new translation keys exist in translations.en.json; alternateLocales has no consumer left; og:title and og:description come from vike-react's settings, per OG_EMITTED_BY_CONFIG (atlas-head.tsx:31); preview.png is 1200×1200, a centred logo on white, so a 1.91:1 crop keeps it whole — manual step 2 is answered.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread lib/content-seo.ts Resolved
Comment thread lib/structured-data.ts Resolved
Comment thread lib/content-seo.ts Resolved
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 19, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 19, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 19, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 19, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-design c9ff7bb Commit Preview URL

Branch Preview URL
Nov 20 2026, 06:30 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-web c9ff7bb Commit Preview URL

Branch Preview URL
Nov 20 2026, 06:30 PM

`<title>` took the composed `We Meditate | <tagline>` form while
`WebPage.name` kept `page.meta?.title || page.title`, which is `Home Page`
in production today — the one string the home page must never serve. The
two now read one answer.

Confirmed against cloud.sydevelopers.com: `homePage.title` is `Home Page`
and its `meta.title` is null, so the fallback fires on the live site.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXKVG7aMsmczcPujHL
Every builder spelled `...(x ? { k: x } : {})` for each optional field, so
the rule the module exists to hold was written twelve times instead of
once. `compact` now holds it, and each builder is a flat literal that hands
SahajCloud's `string | null` straight to the field it belongs to.

`Nullable<T>` is what makes that typecheck: the builders keep their
schema-dts return types, so a misspelled `@type` or an undefined property
is still a compile error. `organizationNode` and an `ItemList` entry keep
plain literals — neither has a field that can be absent.

The omission assertions move to `toStrictEqual`, because `toEqual` passes
on a key present and undefined, which is the one way `compact` could fail
without a red test.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXKVG7aMsmczcPujHL
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Two findings adopted, one rebutted. Lean gate green — eslint, tsc, 1257 tests. Pushed b60f0ac.

Adopted

Rebutted

Waiting on you: the Head: ContentHead placement question — A, per-route, or B, once at the root.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 19, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review November 19, 2026 00:19
@sydevs-bot
sydevs-bot requested a review from Ardnived November 19, 2026 00:19
@sydevs-bot
sydevs-bot enabled auto-merge November 19, 2026 00:19
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 19, 2026

@Ardnived Ardnived left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided in the terminal on 2026-11-18: this PR is reworked, not merged as it stands. The shape stays — one metadata document built in each route's +data.ts, one renderer, nothing set from a shared template, nothing under a live preview or on a non-indexable host. What changes is how the document is generated, and how much it says.

1. Generate it with Unhead, on the server only — after a spike

Use unhead and @unhead/schema-org (both 3.4.3) as a generator behind data.seo, never as component hooks: a component-level head hook is exactly what this repo forbids, because the templates are shared with the embed routes and the live preview.

Facts already checked, so they need no re-deriving:

  • vike-react 0.6.32 (installed) has headHtmlEnd, headHtmlBegin and onAfterRenderHtml. That is the injection point for a rendered head string.
  • Unhead v3, from its docs: createHead from unhead/server, one instance per request; the instance is passed explicitly — useHead(head, …), useSeoMeta(head, …), useSchemaOrg(head, nodes, { tagPosition: 'head' }) (its default is bodyClose); the schema plugin is UnheadSchemaOrg({ host }); head.render() returns { headTags, bodyTags, bodyTagsOpen, htmlAttrs, bodyAttrs }. @unhead/react is not needed.
  • Traps: the server head inserts <meta charset>, the viewport meta and <html lang="en"> by default, and vike-react already writes <title>, the description and lang — nothing may be emitted twice. TemplateParamsPlugin is opt-in in v3; without it %siteName prints literally. Packages are ESM-only. The schema helpers do not check Google's required fields, so the guard and smoke specs here stay and grow.
  • Not documented anywhere: Vike, and Cloudflare Workers. Hence the spike.

The spike, first commit: one route (/lectures/:id) generates its head through Unhead in the Worker build, injected through headHtmlEnd; the PR preview serves it with no duplicated tag and one @graph; the Worker bundle's size change is stated. If the spike fails on any of those, say so in the PR and build section 2 on the existing schema-dts builders instead — the enhancements are wanted either way.

AudioObject has no helper; a meditation stays a custom node, linked into the same graph.

2. Say more — all four groups are in scope

Linked nodes, complete fields

  • Every node carries an @id, and they link: Organization → WebSite → WebPage → the page's main entity and its BreadcrumbList; the page's primary image as an ImageObject; inLanguage on every node, from the URL's locale.
  • A lecture's VideoObject carries what Google requires for a video result: name, thumbnailUrl, uploadDate, plus description, duration and embedUrl (its embed route). Take the date from the lecture's own metadata when it holds one; never invent one.
  • An article carries datePublished, dateModified, author and publisher. Open Graph gains article:published_time, article:modified_time and article:author.
  • og:image carries width, height and alt; twitter:image:alt matches.
  • A robots meta with max-image-preview:large on indexable content routes; the embed routes say noindex.

Embeddable players

  • The meditation and lecture pages advertise their embed: <link rel="alternate" type="application/json+oembed">, a same-origin oEmbed JSON endpoint answering for those two URL shapes only, and twitter:card player with og:video pointing at the embed route. A pasted link then shows the player in WordPress and in chat previews.

More page types

  • A page whose content holds an accordion of questions emits FAQPage with one Question per item (the class pages do).
  • The music library emits a MusicPlaylist of MusicRecordings, with artist and duration where SahajCloud has them.
  • /app emits a SoftwareApplication (MobileApplication) with both store links: https://apps.apple.com/us/app/we-meditate/id6465684494 and https://play.google.com/store/apps/details?id=co.wemeditate.sahajaapp.
  • An article with an author emits a Person with the author's name, title, description and photo.

App and device tags

  • apple-itunes-app with app id 6465684494, on content routes only, never on an embed.
  • A web manifest, an apple-touch-icon and theme-color. Mind the rule that nothing site-wide goes in public/, which the Ladle build also ships.

3. Still true

  • No user-visible literal: every word comes from wm-web-translations, SahajCloud content, or is a brand name.
  • A field is emitted only when SahajCloud returned it.
  • Each new claim gets a guard assertion, and the smoke spec checks a lecture, a meditation, an article, a class page and /app on the preview.

The /app page and the per-page share images are content, being published separately under #160; until /app exists its node cannot be verified on a preview.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 19, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 19, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main in. One conflicted hunk, and one semantic break the clean half left.

main replaced this file's hand-written Lexical block interfaces with the generated ones from server/payload-types.ts. The conflict was getLeadSplash's cast, where this branch had only re-wrapped the line — so main's SplashBlock won with nothing of ours to keep. contentBlocks<T>() and contentIndexBlocks() survive untouched: the two sides edited different parts of the file.

lib/content-seo.ts then stopped compiling, importing the deleted LayoutBlockFields for the accordion-to-FAQ walk. Generated LayoutBlock is a superset — same style union, same items with title and text — so pageQuestions reads that, and the Question nodes claim what they claimed before.

Lean gate green: eslint 0 errors, tsc clean, 1605 tests.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 20, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 20, 2026
- Open Graph and Twitter travel as Unhead's `useSeoMeta` input instead of
  `[key, value]` tuples, so `isOpenGraphKey`, `imageMeta` and the hand-spelled
  player and image structured properties go. A player route now emits one
  `twitter:card` (`player`) rather than two.
- The generator adds the tags every published URL carries: `robots`,
  `twitter:site` and `apple-itunes-app`. `robots` was derived twice, and
  `/map` now carries the other two as well.
- `inLanguage` comes from the schema-org plugin's config, which also fills it
  on the hoisted `ImageObject`s.
- FAQPage is dropped: Google shows FAQ results only for government and health
  sites. The breadcrumb is Home → page, because Google refuses a rung with no
  URL anywhere but last, and the menu heading had none.
- `/oembed` is flattened to `server/oembed.ts` beside `oembed-routes.ts`, as
  `sitemap` is. `playerIframe` takes the size, and no longer `.replace()`s its
  own output. `thumbnail_width` is dropped: the spec requires its height
  beside it, and it held the player's width. `EMBEDDABLE_COLLECTIONS` is
  exported once, and `documentEmbedHref` is typed against it.
- `app-identity.ts` folds into `site-identity.ts`, dropping the unused store
  URLs and the Play Store id.
- The smoke head readers parse with jsdom instead of regexes, which is how the
  `data-hid` vacuous pass happened. The source-scan guard over `+data.ts` text
  goes; the declared-once guard stays.
- `VideoObject.uploadDate` waits on sydevs/SahajCloud#1236.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 20, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 20, 2026
Merged via the queue into main with commit 61d4674 Nov 20, 2026
20 checks passed
@sydevs-bot
sydevs-bot deleted the claude/feat-273-seo-parity branch November 20, 2026 22:24
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 20, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
…ofix

Three files conflicted, all against #282.

`pages/+Head.tsx`: #282 adds the apple-touch-icon, the manifest link and
`theme-color`. Its tags stand, written with their props sorted, so the new
lines satisfy `perfectionist/sort-jsx-props` like the rest of the file.

`lib/head.test.tsx`: #282 rewrote the file around `isSafeJsonLd`,
`seoDocument` and `NoIndexHead`. This branch had only reformatted the two
hreflang tests #282 deletes, and they call a `cluster` helper the rewrite
removes, so they are dead either way. `lib/hreflang.test.ts` carries that
coverage now. Main's side stands.

`pages/[slug]/data.test.ts`: #282 adds `knowledgePages` to the settings
fixture, which this branch does not touch. Main's side stands.

No second mechanical commit follows: `pnpm lint` exits 0 on the merge as it
stands, and the 91 files main brought in need no reformat.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWFmyi3iWXmttQv3au
sydevs-bot added a commit that referenced this pull request Nov 20, 2026
The only conflict was the import block in server/entry.ts: this branch adds
registerLegacyRedirects, main's #282 adds registerOEmbedRoutes. Both stay.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVjP8vYv9piKZ7dSWz
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
#282 landed the SEO head rewrite, which moved the head out of
`Head: ContentHead` and into a `SeoDocument` built in `+data.ts`. Both
conflicts are that rewrite meeting this branch's own work on the same
two files.

AGENTS.md: took main's bullet whole — it describes the architecture that
now exists, and its wording already drops the "cannot disagree" claim
this branch removed. Re-attached this branch's addition to it: the
`[slug]` route's untranslated-page 302, and why the language dropdown
therefore offers the unfiltered locale set.

pages/[slug]/data.test.ts: one `request()` helper carrying both sides'
fields. main needs `urlPathname` and `urlParsed.origin` for the head
document; this branch needs `urlParsed.searchOriginal` for the query
string the 302 keeps. Kept main's `knowledgePages` fixture and this
branch's mutable `availableLocales`, its `{ active, scope, token }`
preview fixture — the real `LivePreviewSession` shape — and both abort
helpers, since `renders404` and `redirectOf` answer different questions.

Lean gate green on the merge: 159 files, 1663 tests.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXihmLRsS3SkmMN8Gv
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
#282 rewrote `lib/head.tsx` onto Unhead: `ContentHead`, `ContentHeadTags` and
`resolveOgImageUrl` are gone, and a content route now builds one `SeoDocument`
in `+data.ts` through `lib/content-seo.ts`. This branch's only conflict was
`lib/head.test.tsx`, which tested the removed `ContentHead`.

Both sides' tests are kept. `lib/head.test.tsx` is main's file plus this
branch's guard that neither new block imports a head helper, now naming
`atlas-seo` rather than the removed `lib/atlas-head`. The canonical-invariance
case moves to `lib/content-seo.test.ts`, beside the fixtures it needs, and
pins the same property against its new owner: `seoRoute` takes the path from
`urlPathname`, so the `?atlas=` and `?locale=` the widget writes reach neither
the canonical nor the hreflang cluster.

`ClassDirectory`'s docblock named `ContentHead` and `useAtlasHead`, neither of
which exists after the merge.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVckmzeP9CM9mbf57b
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
`lib/document-routes.ts` took both sides: the list route's segment and
matcher, and main's embed-route owner (#282). Neither touches the other.

`AGENTS.md` took main's head rule, which replaced the one this branch was
written against, and kept this branch's exception to it — a code route has
no per-locale publish state, so `/meditations` advertises `availableLocales`
whole where a content URL advertises the subset its document is published in.

#282 also removed `ContentHead` and `usePageHead`, which only this branch's
new route still imported: a head is now a `SeoDocument` its `+data.ts`
builds, rendered by the one `headHtmlEnd` generator. So `/meditations`
builds one through `meditationsIndexSeo`, beside the other content builders,
and `tests/guards/content-head.test.tsx` gains its row. Its canonical and
`hreflang` cluster are unchanged; the share card, `robots` and the
`WebSite`/`Organization` graph are what the new mechanism adds.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWc3tPbXfxmwxUuts2
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
#282 replaced `lib/head.tsx`'s `ContentHead` with a `SeoDocument` each route
builds in its `+data.ts`, so `publishedContentUrl` had nothing left to serve.
Took main's file whole, and moved the share row onto `seo.canonical` from the
route data — the same URL `seoHeadHtml` publishes as canonical, so the two
still cannot disagree.

Two behaviours survive the move rather than being rebuilt:

- The window-origin fallback is gone. The canonical rides `data` to the
  browser already, so there is nothing to rebuild from a path-only `urlParsed`.
- Live-preview suppression is now an explicit check in `+Page.tsx`. `+data.ts`
  builds `seo` under an open preview too, and `seoHeadHtml` drops the whole
  head there; a draft's URL 404s publicly, so it is not one to hand a sharer.

`tests/a11y/page-types.test.tsx` now gives its two content targets the `seo`
document the route hands a page, built by `pageSeo`. Without one the page
reads `canonical` off `undefined`, and the article target would walk an axe
run missing the share row.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZRp55YtiuL4Mk3wrn
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
The share row now reads its URL from `data.seo.canonical` (#282's shape), so a
target whose route data carries no `seo` reads `canonical` off `undefined` and
the render throws. `pageSeo` builds the fixture, so the article target walks
an axe run with the row on it rather than without.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZRp55YtiuL4Mk3wrn
sydevs-bot pushed a commit that referenced this pull request Nov 20, 2026
`layouts/LayoutChrome.tsx` was the only conflict. Both sides moved the
same two lists, in opposite directions: this branch lifted `languages`
and `socialLinks` into `useSiteNav`, so the footer and the phone menu
read one list on both layouts, while #282 replaced the layout's
hard-coded social array with `SOCIAL_PROFILES` in `lib/site-identity.ts`
and kept `languages` local.

Both intents hold: `useSiteNav` stays the one place the layouts read,
and it now returns `SOCIAL_PROFILES` rather than a second copy of the
same three profiles. `lib/content-seo.ts` claims that constant as the
`Organization`'s `sameAs`, so a profile added there reaches the markup,
the footer and the menu together.

`SOCIAL_PROFILES` is `readonly`, which `Footer` already took, so
`SiteNav.socialLinks` and `MobileMenu`'s prop widen to match.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjV1jbvBJgicqpdxHKQ
Ardnived added a commit that referenced this pull request Nov 20, 2026
#282 listed every tag, module and consumer of the SEO head in a guide that
loads in every session. Each module's own header holds that; the guide keeps
the opt-in, the once-only generator and its guard test, the no-head-hook rule
and the hreflang owner.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

feat(seo): share metadata and JSON-LD at parity with the old site

3 participants