Skip to content

feat(flame): add meta.verification for site-verification meta tags - #488

Merged
gitfromwildan merged 1 commit into
mainfrom
feat/meta-verification
Nov 6, 2026
Merged

gitfromwildan merged 1 commit into
mainfrom
feat/meta-verification

Conversation

@gitfromwildan

Copy link
Copy Markdown
Member

Summary

Adds meta.verification to docu.json. With it, the Algolia Crawler can verify the site's domain through a meta tag, and so can Google Search Console and similar services. Each entry, keyed by meta name, becomes a <meta> tag in the <head> of every page Flame builds.

{ "meta": { "verification": { "algolia-site-verification": "ADCCB4B3D3A8BDCE" } } }

renders

<meta name="algolia-site-verification" content="ADCCB4B3D3A8BDCE">

Why

The Algolia Crawler verifies a domain by looking for <meta name="algolia-site-verification"> in the static HTML of the home page. It ignores a tag added by Google Tag Manager. Flame had no way to add such a tag:

  • A plugin's injectHead does reach every page.
  • But @docubook/plugin-search-algolia injects only on docs pages, so the landing page at / had nothing.
  • A site-verification token is site config, not a search option, so it belongs in meta next to title, baseURL and ogImage.

Change

  • DocuMeta.verification: Record<string, string>, meta name → token.
  • htmlShell (html.ts for Bun, html.shared.ts for Node/Deno) gets a verification option and a shared verificationTags() helper.
    • Each entry is written right after <meta name="description">.
    • Names and tokens are trimmed and escaped.
    • Entries whose name or token is not a non-empty string are skipped.
  • Callers.
    • Both builds pass meta.verification for docs pages, the landing page and the 404 page.
    • The dev server (server-routes.ts) passes it for every page it renders.
  • docu.schema.json declares meta.verification: an object whose property names match ^[A-Za-z0-9._:-]+$ and whose values are non-empty strings. Before, meta had additionalProperties: false, so editors flagged the field.
  • Docs.
    • configuration.mdx gets a verification row and a "Site verification" section. It covers the experimental.pages case, where the home page is the project's own: add the tag there, or give the service a docs page URL (Algolia's "Optional URL").
    • The Algolia page's crawler setup step is now "Add and verify your domain", with the docu.json snippet and the Verify now step.
  • Changeset: @docubook/flame minor. It joins the pending 2.6.0 release.

Verification

  • Temp project, end to end. The template with algolia-site-verification and google-site-verification set.
    • flame build on Bun and on Node writes both tags into index.html (landing), docs/index.html, docs/getting-started/overview.html and 404.html.
    • flame dev serves the tag on /, /docs, a docs page and an unknown path (404).
    • Incremental build: after changing the token and building again without cleaning, every page carries the new token on both runtimes, so a docu.json change invalidates the build cache.
  • Docs site. turbo build --filter=@docubook/flame... passes. The new Configuration and Algolia sections render with their code blocks. scripts/flame-browser-smoke.mjs passes (5 pages).
  • Checks.
    • flame: 867 tests in 42 files, oxlint, and tsc --noEmit pass.
    • New tests:
      • tag order after the description;
      • trimming;
      • escaping of a name and a token that each carry "><script>;
      • skipped entries (empty, blank, non-string, empty name);
      • no output without the field;
      • the schema's type and name pattern;
      • the dev server's home and 404 pages.
    • The pre-push hooks and scripts/check-release-plan.mjs (6 scenarios) pass.

After merge

To verify docubook.pro, add the code from Algolia's Domains → Meta tag tab to packages/flame/docu.json under meta.verification, deploy, then click Verify now.

The Algolia Crawler verifies a domain through a <meta name="algolia-site-verification" content="..."> tag in the static HTML of the home page, and Google Search Console works the same way. Flame had no way to add one: plugins only reach docs pages through injectHead, and the Algolia plugin injects nothing on the landing page.

docu.json now accepts meta.verification, a map from meta name to token. htmlShell (html.ts and html.shared.ts) writes each entry after the description meta, escaped and trimmed, skipping entries whose name or token is not a non-empty string. Both builds pass it for docs, landing and 404 pages, and the dev server for every page it renders. The schema declares the field with a meta-name pattern, and the configuration and Algolia docs explain how to verify a domain with it.
@vercel

vercel Bot commented Nov 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docu Ignored Ignored Nov 6, 2026 6:36am UTC

@gitfromwildan gitfromwildan self-assigned this Nov 6, 2026

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

Mode: standard. I reviewed the whole diff for the new meta.verification config field. That covers rendering, call sites, schema, tests and docs. Overall this is ready to merge.

  • verificationTags() helper: it lives in html.shared.ts and both shells share it. html.ts passes Bun.escapeHTML and html.shared.ts passes escapeHtml, so Bun and Node/Deno output match, as the runtime-parity rule requires. Names and tokens are trimmed and escaped, and entries that are not strings or are empty are skipped. That matters because loadDocuConfig() in paths.ts only runs JSON.parse on docu.json, so this helper is the only check at runtime. Widening HtmlShellOptions.verification to Record<string, unknown> is the right call.
  • Call sites: every htmlShell caller passes the field. That is the docs page, landing page and 404 page in both build.ts and build.impl.ts, plus createHtmlResponse in server-routes.ts for the dev server. A grep found no other callers, so no page is left without the tag.
  • Build cache: configStamp() in cache-key.ts already hashes the full resolved docu.json. Changing a token therefore re-renders every page, and BUILD_CACHE_VERSION does not need a bump.
  • Schema and types: DocuMeta.verification and the docu.schema.json entry agree. Without the schema entry, editors would flag the field, because meta sets additionalProperties: false. The propertyNames pattern accepts real provider names such as msvalidate.01 and rejects quotes and spaces.
  • Tests: they cover tag order, trimming, XSS escaping of both the name and the token, skipped entries, no output when the field is absent, the schema shape, and dev-server output on the home and 404 pages.
  • Docs and changeset: the #site-verification and #experimental anchors resolve. The caveat about experimental.pages is accurate, because no landing page is built in that mode. The @docubook/flame minor changeset is in place.

Top priorities: none. No CRITICAL, HIGH or MEDIUM findings passed the admission rules.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@gitfromwildan
gitfromwildan merged commit dffd7d2 into main Nov 6, 2026
15 checks passed
@gitfromwildan
gitfromwildan deleted the feat/meta-verification branch November 6, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant