Skip to content

docs(embedding): document the head metadata a host writes per atlas route #173

Closed

Description

@Ardnived

Summary

docs/embedding.md is the host-facing contract, and it never says what a host should put in its
<head>. Since sydevs/SahajCloud#769 merged, GET /api/atlas/seo answers every route the
widget can mount with — the atlas root included — so the rule is finally writable: a page's
metadata describes the atlas route the widget mounted with
, and that endpoint supplies it.

The blocker is cleared. What is left is documentation in this repo. No widget code changes.

What shipped upstream (verified against the SahajCloud checkout at 4847641)

sydevs/SahajCloud#739, closed 2026-09-12 by sydevs/SahajCloud#769:

  • The root answers. parseAtlasRoute returns { kind: 'root' } when the segment list is
    empty once reserved words are dropped — src/endpoints/atlas/seo/atlasRoute.ts:121-123.
  • Eleven reserved segments, not the five this ticket named. search, calendar, filters,
    register, share, online, preview, plus the legacy prefixes events, areas, regions,
    venues (atlasRoute.ts:31-42). So /events/areas resolves to the root too. The doc must state
    the rule, not a list of five.
  • The root document: type: 'root', id: null, route: '/', empty breadcrumbs, a WebSite
    JSON-LD node and no BreadcrumbList (seoDocument.ts:458-493).
  • The copy is operator-written, on a new seo group of sy-atlas-translations. title is
    seo.root_title, then that same locale's common.chrome.widget_label, then English, then
    the constant Free Meditation Classes. description never falls back — a locale without one
    gets null (rootStrings.ts).
  • ⚠ Nobody has written that copy yet, and it is now somebody's job: no seed carries a seo
    group (seeds/sy-atlas-translations/data.*.json), so today every locale's root title is its own
    common.chrome.widget_label — Kostenlose Meditationskurse in German — and description is
    null everywhere. Filed as feat(translations): seed atlas landing-page SEO copy in ten locales SahajCloud#778. The doc must therefore state the rule, not
    today's snapshot
    — see Approach 3.
  • The root's canonical is the caller's own verified mount page, read off its clients
    record, falling through to the We Meditate surface when the caller can publish none
    (index.ts:140-163). It is therefore per-API-key: two hosts asking for / get different
    canonicals, by design.
  • The response is edge-cacheable, and cheap for a host to cache too.
    publicReadCacheHeaders(req, ['events', 'regions']) (index.ts:469) emits
    Cache-Control: public, max-age=300, s-maxage=300, Vary: Authorization and
    Cache-Tag: events,regions — 300s because a custom endpoint inherits the lowest TTL of the
    collections it reads, and events is 300 (src/plugins/cache/policy.ts).
  • 400 vs two 404s. An empty or over-512-character route is a 400 from the query schema
    (index.ts:100). A route carrying ?, # or whitespace, or over twelve segments, is
    404 "That is not a valid atlas route." (index.ts:456). A well-formed route naming no row is
    404 "That route does not name a region or an event."
  • Auth is requireActiveClient — a published clients API key, sent as
    Authorization: clients API-Key <key>, the same header the widget itself sends
    (src/config/api/client.ts:42).

Approach

Prose only. Nothing under src/ changes, and no test is added.

  1. A new section in docs/embedding.md, between ## The URL (docs/embedding.md:497) and
    ## Content-Security-Policy (:538), with an entry in the Contents list (:109-124).
    State the rule first — your page's metadata describes the atlas route the widget mounted
    with
    : the atlas parameter on the script URL (:143), or the pathname under routing=path
    (:230). Then three worked examples, each copied from a real response:
    • a region route — ?route=/gb/london
    • the root — ?route=/, the ordinary "here is our class finder" page
    • a bare view route — ?route=/search, which answers with the root's document and a
      normalized route: '/'
  2. Say how to call it, and say to cache it. The URL, the API key header, locale, and that
    jsonLd arrives already serialized and escaped — emit it verbatim, do not re-escape. Name the
    400/404 split so a host can tell "you sent nonsense" from "no such city". Then the caching
    advice, decided by @Ardnived on 2026-09-13:
    • Fetch it on your server, at render time, behind your own cache — <head> metadata has to
      be in the HTML a crawler receives, so a browser fetch is not an option.
    • Cache for up to 300 seconds, keyed by route and locale. That is the endpoint's own
      max-age.
    • Vary: Authorization costs you nothing. The key is your site's own published client key,
      not a visitor's credential, so it never varies between your visitors — one cached variant per
      site, not one per user. Say this explicitly: the header otherwise reads as "do not cache".
  3. Say what a host that ignores it writes instead, and state the description rule rather
    than today's snapshot: a locale with no operator copy returns description: null, and a host
    that gets null supplies its own one-line description in its own language, plus a
    self-referencing <link rel="canonical"> on the mounted URL. Tie this to the canonical embed
    record the doc already describes (:244-245, :286). ⚠ Do not write "every locale is
    null today" — feat(translations): seed atlas landing-page SEO copy in ten locales SahajCloud#778 fills that copy, and the sentence would be stale on the
    day it merges. The rule is true before and after.
  4. The CSP table does not change — say so. A host fetches this from its own server, so no
    directive covers it, and cloud.sydevelopers.com is already in connect-src (:543-551) for
    the widget's own reads. This settles the "update the CSP table" item this ticket used to carry.
  5. CHANGELOG.md gets an ### Added entry under ## [Unreleased] (CHANGELOG.md:19), per
    the repo rule that it and docs/embedding.md move together.

Acceptance criteria

  • docs/embedding.md states that page metadata describes the mounted route, with worked
    examples for a region route, the root, and a bare view route.
  • It names GET /api/atlas/seo, its auth header, its locale parameter, and that jsonLd is
    emitted verbatim.
  • It states the rule for which routes answer as the root, covering all eleven reserved
    segments rather than the five #739 named.
  • It says to fetch server-side and cache for up to 300s per route and locale, and explains
    that Vary: Authorization means one variant per site, not one per visitor.
  • It says the root's canonical is the caller's own verified mount page, and what a caller
    owning none receives.
  • It says description is null in a locale with no copy, and what the host writes instead —
    stated as a rule, with no claim about how many locales are empty right now.
  • It distinguishes the 400 from the two 404s.
  • It states that the CSP table is unchanged, and why.
  • CHANGELOG.md carries a host-visible entry under ## [Unreleased].
  • The Contents list carries the new section.
  • No file under src/ changes.

Verification checklist

  • grep -n "atlas/seo" docs/embedding.md CHANGELOG.md — both files hit.
  • grep -n "max-age=300\|Vary" docs/embedding.md — the caching advice is present.
  • The new ## heading appears in the Contents list at docs/embedding.md:109-124, spelled
    identically to the heading.
  • git diff --name-only main lists only docs/embedding.md and CHANGELOG.md.
  • pnpm lint && pnpm typecheck && pnpm test:run — the lean gate, green.
  • With a published client key against SahajCloud:
    curl -i -H "Authorization: clients API-Key $KEY" "https://cloud.sydevelopers.com/api/atlas/seo?route=/&locale=en"
    returns 200 with "type":"root", "id":null, "route":"/", and response headers
    Cache-Control: public, max-age=300, s-maxage=300 and Vary: Authorization.
  • The same call with route=/search returns the same document, route still /.
  • The same call with locale=de returns a German title; note whether description is
    null at the time of writing, but do not put that count in the doc.
  • route= returns 400; route=/gb/london?x=1 returns 404 "That is not a valid atlas route.";
    route=/no-such-city returns 404 "That route does not name a region or an event."
  • Every worked example in the doc is pasted from one of those responses, not written by hand.

Open questions

Downstream impact

Notes

Blocked by: sydevs/SahajCloud#739 — cleared. Closed 2026-09-12 by
sydevs/SahajCloud#769. Kept as the record of what this waited on.

  • ⚠ The endpoint's docblock contradicts itself about the title fallback:
    src/endpoints/atlas/seo/index.ts:421-424 still says the title "falls back to English and then
    to a constant", while rootStrings.ts and SahajCloud docs/architecture.md:56 say it exhausts
    the locale first. The shipped code matches the second. Write this repo's doc from the code — the
    docblock is worth a one-line SahajCloud fix, now carried by feat(translations): seed atlas landing-page SEO copy in ten locales SahajCloud#778.
  • Why this was worth fixing rather than leaving to each host. The root view is the most
    linkable URL of the set: it is the page a host links from its own nav, and it is where this
    document already sends people — the compact card's new-tab fallback is documented as going to
    wemeditate.com/map (docs/embedding.md:493). A destination the docs name should not be the one
    destination with no metadata guidance.
  • Observed on feat(map): server-rendered atlas routes under /map, plus sitemap and robots (C4) WeMeditateWeb#62 (C4), which mounts /map with atlas=/: the page
    inherits the global site title and description and emits no canonical, so /map presents to a
    crawler as a duplicate of the site's homepage. Every region and class page under it is correctly
    described; only the entry point is not. C5, the WordPress plugin behind 13 of 29 client domains,
    hits the same thing with far less room to work around it.
  • The deciding constraint was translation. Whoever writes the root metadata writes it in ten
    languages — the same constraint that made feat(api): serve SEO metadata for an atlas route (C3) SahajCloud#646 return description: null for
    regions rather than invent an English sentence.
  • Verified in this repo: grep -rn "atlas/seo" src/ docs/ CHANGELOG.md returns nothing, and every
    existing mention of "canonical" in docs/embedding.md is about the client record's canonical
    embed or the widget's share links — never the page's own metadata.
  • Related: feat(api): serve SEO metadata for an atlas route (C3) — blocks the WordPress plugin and WeMeditateWeb SSR SahajCloud#645 / #646 (the C3 endpoint and the 404-on-root decision #739
    reversed); feat(map): let map mode be contained by an element, not only the viewport #170 (contained map mode, which makes an in-layout root view ordinary for a host).

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

Activity

  1. added theissue type on Aug 28, 2026
  2. Ardnived commented on Sep 6, 2026

    @Ardnived
    ContributorAuthor

    The metadata for all route URLs should be supplied by the SahajCloud server via GET /api/atlas/seo. Client sites are free to ignore this and embed their own metadata, but SahajAtlasWordpress should supply it by default (maybe with a configuration option to disable it).

    @sydevs-bot Clarify this ticket and create appropriate tickets to provide the needed functionality from SahajCloud and an appropriate follow-up ticket in SahajAtlasWordpress. Use the draft-ticket skill.

  3. sydevs-bot commented on Sep 8, 2026

    @sydevs-bot
    Contributor

    Both tickets filed; the decision is in the body. #173 keeps the docs/embedding.md work only, blocked on the endpoint so the prose describes real behaviour.

    Both Proposed, unassigned.

    ⚠ Two calls are yours.

    1. Where the ten translations live — a rootSeo group on sy-atlas-config, or sy-atlas-translations, which #706 is rewriting now. I lean the config global. On #739.
    2. The opt-out is a second WordPress setting, against that plugin's "configuration is a cost" rule. Ship it anyway: a silent takeover of Yoast is unreportable by 13 volunteer-run domains. On feat(ui): white-label brand palette for the embedded widget #16.

    ⚠ Native Blocked by relationships are unset — a routine reaches no tool that writes them.

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


    Generated by Claude Code

  4. Ardnived commented on Sep 13, 2026

    @Ardnived
    ContributorAuthor

    @sydevs-bot Revise this ticket based on recent updates to the code in SahajCloud#769 and possibly in other tickets

  5. added
    bot:working
    and removed on Sep 13, 2026
  6. 11 remaining items

  7. added
    bot:working
    on Sep 14, 2026
  8. sydevs-bot commented on Sep 14, 2026

    @sydevs-bot
    Contributor

    Both answers are now in the body.

    • Caching — fetch it server-side and cache up to 300s, keyed by route and locale. The Authorization is your site's own key, so Vary: Authorization splits the cache per site, not per visitor. Approach 2.
    • The missing copy — filed as feat(translations): seed atlas landing-page SEO copy in ten locales SahajCloud#778 to fill the seo group in the ten locale seeds. Comment @sydevs-bot implement there to start the PR you asked for. This handler writes prose only.

    One criterion changed as a result: the doc states the description: null rule, not "every locale is empty today" — sydevs/SahajCloud#778 makes that sentence false the day it merges.

    Verified this run: the response carries Cache-Control: public, max-age=300, s-maxage=300 and Vary: Authorization (seo/index.ts:469, plugins/cache/policy.ts).

    Title, type and Effort (Easy) unchanged. Comment @sydevs-bot implement to start this ticket.

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


    Generated by Claude Code

  9. added and removed
    bot:working
    on Sep 14, 2026
  10. sydevs-bot commented on Sep 14, 2026

    @sydevs-bot
    Contributor

    @Ardnived unblocked: every blocker is closed. Say @sydevs-bot implement to start.

    🤖 sydevs dispatcher

  11. Ardnived commented on Sep 14, 2026

    @Ardnived
    ContributorAuthor

    @sydevs-bot implement

  12. added
    bot:working
    and removed on Sep 14, 2026
  13. moved this from Revising to Approved in SYDevelopers Technical Roadmapon Sep 14, 2026
  14. removed
    bot:working
    on Sep 14, 2026
  15. added a commit that references this issue on Sep 14, 2026
    2c26075
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    Medium

    Hold Until

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions