Repository navigation
docs(embedding): document the head metadata a host writes per atlas route - #207
Conversation
…oute `docs/embedding.md` is the host-facing contract, and it never said what a host should put in its `<head>`. Every region and class page under an embed was described correctly by the sites that bothered; the entry point was not. #62 on WeMeditateWeb mounts `/map` with `atlas=/` and presents to a crawler as a duplicate of the site's homepage, because the page inherits the global title and description and emits no canonical. The rule is finally writable: sydevs/SahajCloud#769 made `GET /api/atlas/seo` answer **every** route the widget can mount with, the atlas root included. So the new section states the rule — a page's metadata describes the atlas route the widget mounted with — and names the endpoint that supplies it. What it covers, each verified against the shipped code and a live call: - Three worked examples, pasted from real responses: a region route, the root, and a bare view route. The region example also shows that `route` comes back normalized (`/gb/london` answers `/gb/south-east/london`), which a host comparing its canonical needs to know. - Which routes answer as the root, as a RULE rather than a list of five: eleven reserved segments are dropped wherever they appear, so `/events/areas` reduces to the root too. - Fetch server-side at render time, and cache for up to 300s per route and locale. `Vary: Authorization` splits that cache per SITE, not per visitor, because the credential is the host's own published client key — the header otherwise reads as "do not cache". A server-to-server call also sends no Origin, which the allowed-domains gate deliberately permits. - `canonical` for the root is the caller's own verified mount page, and so is per-API-key; a caller publishing none gets the We Meditate surface. - `description` is `null` in a locale with no operator copy, stated as a rule rather than as today's snapshot — sydevs/SahajCloud#778 fills that copy and would make a snapshot sentence false the day it merges. The host writes its own line and a self-referencing canonical. - The 400 and the two 404s, which say different things on purpose. - That the CSP table does not change, and why: the host's server makes the request, and `cloud.sydevelopers.com` is already in `connect-src`. `CHANGELOG.md` carries the host-visible entry, per the rule that it and `docs/embedding.md` move together. Nothing under `src/` changes. Closes #173. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`jsonLd`'s escaping names what is actually escaped — `<`, `>`, `&` and the two Unicode line separators (`jsonLdEscape` in SahajCloud's `seo/jsonLd.ts`) — so a host reading "already escaped" knows what re-stringifying would lose. `canonical` can be `null` for a region or an event, where no site publishes one (`seo/index.ts` reads `region.webUrl ?? null`). The section said it resolves, full stop. It now says what a `null` means and what to write instead. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying sahajatlas-design with
|
| Latest commit: |
2771557
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://10cb2db3.sahajatlas-design.pages.dev |
| Branch Preview URL: | https://claude-docs-173-embed-head-m.sahajatlas-design.pages.dev |
Deploying sahajatlas with
|
| Latest commit: |
2771557
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://519b5c2b.sahajatlas.pages.dev |
| Branch Preview URL: | https://claude-docs-173-embed-head-m.sahajatlas.pages.dev |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The diff is the two files the ticket pins, and every subsection maps to an acceptance criterion. Nothing extra.
One shape, two findings: all three examples came from a key owning no canonical and a database with no root copy, so their headline values are fallbacks — the "snapshot, not rule" trap the ticket flagged for description. Separately, the locale row advises a call that 400s.
Findings
- blocker —
:559"send your<html lang>" 400s foren-GB,en-USorpt. The refusal table omits it. - should-fix —
:583theworkers.devhost, printed 8 times, contradicts line 495. - consider —
:616the example root title is the fallback constant.
Checked against SahajCloud 0a65797: atlasRoute.ts (11 segments, case-insensitive, [?#\s] and the 12-cap → 404), index.ts (schema, both 404 strings, headers), rootStrings.ts, jsonLd.ts, seoDocument.ts (locale-free canonical), locales/index.ts (19 exact codes), usage/hooks.ts:288 (no Origin → allowed). Here: path.ts:238-250 has the same 11.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`locale` is refined with `isValidLocale` against nineteen exact codes (SahajCloud `src/lib/locales/index.ts:14-33`), and `parseQuery` answers 400 on a miss. "Send the language your page declares in `<html lang>`" therefore breaks any host declaring `en-GB`, `en-US` or `pt`, and the refusal table blamed `route` for the 400 it got. Names the set, gives the mapping rule, and adds `locale` to the 400 row. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FKvtzMtoVcN1VjWqbdHZaA
The examples printed `wemeditate-web.contact-c66.workers.dev` eight times, while the compact-card section names `wemeditate.com/map` as the same fallback surface — two answers to one question. sydevs/SahajCloud#783 asks whether that host is a misconfiguration at all, so baking it into the host-facing contract risks documenting a transient state. `…/map…` matches how `alternates` and `breadcrumbs` already abridge, so the responses stay pasted rather than hand-written, and a new paragraph says what the ellipsis stands for. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FKvtzMtoVcN1VjWqbdHZaA
`Free Meditation Classes` is `ROOT_TITLE_FALLBACK` (SahajCloud `src/endpoints/atlas/seo/rootStrings.ts:48`), the bottom of the chain, reached only because no operator root copy exists in any locale yet — `locale=de` returns the same English string. Printed bare, the example read as the root's real title and would date the day the copy lands. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FKvtzMtoVcN1VjWqbdHZaA
|
Three review threads adopted, one commit each. Pushed to
Nothing rebutted, nothing asked. Lean gate green — 1467 tests in 115 files. PR body refreshed with the round. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
docs/embedding.mdgains Metadata for your page's<head>— the rule that a page's metadata describes the atlas route the widget mounted with, and the endpoint that supplies it.…. Caching, the canonical, thenulldescription, the acceptedlocalecodes, and the 400/404 split each get a rule.src/changes.CHANGELOG.mdcarries the host-visible entry.Changes
docs/embedding.md— new##section between The URL and Content-Security-Policy, plus a Contents entry and a "what do you want" row.CHANGELOG.md—### Addedentry under## [Unreleased].Contract impact
This is the host-facing contract.
GET /api/atlas/seoshipped in sydevs/SahajCloud#769 (closing sydevs/SahajCloud#739); this documents it for the sites that embed us.description: nullrule rather than today's snapshot: a snapshot sentence would be false the day #778 merges.cloud.sydevelopers.comis already inconnect-src.Review round (2026-09-14)
Three threads from the adversarial review, all adopted, one commit each:
localeis refined against nineteen exact codes (isValidLocale, SahajCloudsrc/lib/locales/index.ts:14-33) andparseQueryanswers 400 on a miss. "Send the language your page declares in<html lang>" therefore broke any host declaringen-GB,en-USorpt, and the refusal table blamedroutefor that 400. The doc now names the set, gives the mapping rule, and nameslocalein the 400 row.wemeditate-web.contact-c66.workers.devoccurrences are elided to…/map…, matching the abridgementalternatesandbreadcrumbsalready use. They contradicted line 495'swemeditate.com/mapand are the subject of feat(pages): place pages in each service by its configuration SahajCloud#783, so printing them would have baked a possibly-transient host into a permanent contract.Free Meditation ClassesisROOT_TITLE_FALLBACK(rootStrings.ts:48), reached only because no operator root copy exists in any locale. A ⚠ under the root example says so, rather than letting the example read as the root's settled title.Test results
lint + typecheck + test:run— 1467 tests in 115 files, 46s (re-run after the three commits above).Manual verification
#metadata-for-your-pages-head.…/map…examples still read as real responses rather than invented ones. See Notes for reviewer.Preview
Docs-only — no rendered change to preview.
Notes for reviewer
⚠ The live endpoint returns a
workers.devcanonical; the examples no longer print it. Every call against production came back withhttps://wemeditate-web.contact-c66.workers.dev/map…ascanonical, for the root and for/gb/londonalike. It reaches every canonical andwebUrlSahajCloud publishes for a region no client owns, not just this endpoint. Filed as sydevs/SahajCloud#783 — it needs someone who can read Railway's env to say whether it is a misconfiguration or a deliberate mid-migration state, so that ticket asks the question before it asserts the fix. The examples now elide that origin to…, and a line says what the ellipsis stands for. If you would rather the real host appear, say so and I will restore it.⚠ The German root title is the English constant today, not
Kostenlose Meditationskurseas the ticket expected:?route=/&locale=dereturns"title": "Free Meditation Classes". Socommon.chrome.widget_labelis empty in German too, not onlyseo.root_title. The doc states the fallback chain, which is true either way, and now says the example title is the built-in constant — but sydevs/SahajCloud#778 may be wider than it looks.README.mdline 23 summarises what the integrator guide covers and does not mention the new section. Left alone deliberately — the ticket pins the diff to two files, and the README merely points at the guide. (Separately, that same sentence says "all six script-URL parameters" while the guide says five. Pre-existing.)Detail
Every claim was checked against the shipped code, then against a live call. The SahajCloud checkout at
0a65797suppliedatlasRoute.ts,rootStrings.ts,seoDocument.ts,index.tsandjsonLd.ts; the live endpoint supplied the responses. Both agreed, with the two exceptions above.Verified live, with a published client key:
?route=/&locale=en"type":"root","id":null,"route":"/"?route=/search&locale=en?route=/events/areas?route=/gb/london&locale=en"route":"/gb/south-east/london"— normalized?route=?route=/gb/london?x=1That is not a valid atlas route.?route=/no-such-cityThat route does not name a region or an event.Cache-Control: public, max-age=300, s-maxage=300,Vary: AuthorizationTwo facts the ticket did not carry, added from the source:
routecomes back normalized —/gb/londonanswers/gb/south-east/london. A host comparing its own URL against the returnedrouteneeds to know. Called out with a ⚠ under the region example.OriginorReferer, and the allowed-domains gate permits exactly that (assertClientOriginAllowed,src/plugins/usage/hooks.ts:288-290). Without this line, "fetch it from your server" reads like advice that will hit a 403.Two claims tightened in the second commit, after re-reading the source:
jsonLd's escaping now names what is escaped (<,>,&, U+2028/2029), andcanonicalis documented as nullable for a region or event, which the first draft implied always resolved.The 400 envelope differs from the two 404s. A schema refusal returns zod issues (
parseQuery,Response.json({ errors: parsed.error.issues }, { status: 400 })), not the{ errors: [{ message }] }envelope the 404s use. The refusal table describes what the 400 means rather than quoting a sentence, for that reason.Skipped, with reasons.
/simplifyand the six review lenses read code; this diff is prose in two files and contains none. In their place: the fact-check above, re-run against the source. The security review is skipped by the gate —securityReview.triggerPatternmatches no path in the diff, andcontentPatternscanssrc, which is untouched.Prettier was not run. Both files already fail
prettier --checkonorigin/main, so markdown is not gate-enforced here; formatting them would have buried the content in a whole-file reflow.Closes #173
🤖 Written by the sydevs autonomous loop — see what this is