Repository navigation
feat(docs): sitemap, canonical, Open Graph and structured data - #77
Merged
Merged
Conversation
The site was already fully prerendered, so its content was crawlable — but nothing told a search engine how to discover, canonicalise or describe it. - `/sitemap.xml`, generated from the component registry and guide nav exactly like `/llms.txt`, so a new component page is discoverable the moment it is registered. 67 URLs; `ready: false` entries are excluded because they 404. - `robots.txt` now points at it. - A single `<Seo>` component emits title, description, canonical, Open Graph, Twitter card and JSON-LD, so the tags cannot drift page to page. - JSON-LD: WebSite and SoftwareApplication on the landing, TechArticle and BreadcrumbList on every doc page, ItemList on the component index. - `static/og.png` (1200x630), generated by `pnpm gen:og` with the Playwright Chromium already installed for the visual suite. Deliberately NOT part of `build` — the Vercel builder has no browser — so the PNG is committed. - Component pages move from `Button — Sve·UI` to `Svelte Button Component — Sve·UI`. Sixty pages that competed for nothing now each carry their own long-tail query. The `<h1>` stays plain: the title already carries the term and the docs should not read like a keyword list. `gen-og.mjs` strips comments before counting `ready: true` — the registry's own header documents that field in prose and would have put 61 on a public image the site itself contradicts.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The site was already fully prerendered, so Google could read it — but nothing told a search engine how to discover, canonicalise or describe it. There was no sitemap, no canonical tag, no Open Graph and no structured data, and the ~60 component pages all carried titles (
Button — Sve·UI) that competed for nothing.This adds the technical SEO layer and puts the keyword into the titles that have the most to gain from it.
Review path
Start at
apps/docs/src/lib/seo/— three small files that everything else consumes:site.ts— the only place an absolute URL is spelled out.Seo.svelte— the single component that emits every tag, so they cannot drift page to page.schema.ts— the schema.org builders.Then
src/routes/sitemap.xml/+server.ts(same generated-from-the-registry pattern as the existing/llms.txt) andDocPage.svelte, where one edit reaches all 64 documentation pages.Intentionally out of scope: per-page OG images. Sixty generated PNGs is not worth the build cost yet. Off-site work (Search Console, sveltesociety.dev, awesome-svelte) is where the actual ranking fight is, and it is not code.
Changes
src/lib/seo/site.tssrc/lib/seo/Seo.sveltesrc/lib/seo/schema.tsWebSite,SoftwareApplication,TechArticle,BreadcrumbList,ItemListsrc/routes/sitemap.xml/+server.tsstatic/robots.txtAllow: /plus theSitemap:linestatic/og.pngscripts/gen-og.mjspnpm gen:ogsrc/app.htmltheme-colorfor light/dark,apple-touch-iconsrc/lib/docs/DocPage.sveltekindandseoTitleprops — one edit covers 64 pages+page.svelte(home, components, playground, 4 guides)<Seo>, keyword-bearing titlesTitles
/Sve·UI — Styled, accessible Svelte 5 components. Zero config.Sve·UI — Svelte UI Component Library for Svelte 5/componentsComponents — Sve·UISvelte UI Components — 60 Accessible Components — Sve·UI/components/*Button — Sve·UISvelte Button Component — Sve·UI/docs/themingTheming — Sve·UITheming Svelte Components with CSS Variables — Sve·UIThe
<h1>on each component page stays plain (Button). The<title>already carries the term, and the docs should not read like a keyword list.Two notes for the reviewer
gen:ogis not part ofbuild. The Vercel builder has no Chromium, so the PNG is generated locally and committed. Runpnpm gen:ogafter changing the tagline, the count or the branding.gen-og.mjsstrips comments before countingready: true. The registry's own header documents that field in prose; without stripping, the public image would have claimed 61 components whilecheck-docs-coveragereports 60.Test plan
pnpm test— 644 tests across 72 files, run with--force(not from cache)pnpm lint && pnpm check && pnpm buildall green;pnpm format:checkcleanpnpm --filter docs check:render— 67 pages structurally unchanged.vercel/output/static/: exactly one canonical, oneog:imageand one JSON-LD block per page, and the sitemap's 60 component URLs match the 60 route directories exactlyvisual.spec.tscaptures.preview__canvasonly, not the hero or the indexChecklist
pnpm test)pnpm lint && pnpm check && pnpm buildall greenapps/docsis private and no library code changed