Skip to content

Consolidate site metadata and add metadata preview tests#29

Open
leoisadev1 wants to merge 5 commits into
mainfrom
t3code/833fee0d
Open

Consolidate site metadata and add metadata preview tests#29
leoisadev1 wants to merge 5 commits into
mainfrom
t3code/833fee0d

Conversation

@leoisadev1
Copy link
Copy Markdown
Member

Summary

  • Consolidated the fumadocs root head metadata into a shared siteMeta module.
  • Switched the root route to consume the shared metadata instead of inlining the full meta tag list.
  • Added a cache-busted canonical Open Graph image URL and covered the preview metadata with bun:test checks.
  • Added an apps/fumadocs test script for running the new metadata tests.

Testing

  • Not run (not requested).
  • Added bun test coverage for the canonical OG/Twitter image URL and twitter:card preview format.

- Move root head metadata into a shared helper
- Pin the canonical OG image URL and verify Twitter cards
@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

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

Project Deployment Actions Updated (UTC)
email-sdk-fumadocs Ready Ready Preview, Comment May 30, 2026 3:28pm

@leoisadev1
Copy link
Copy Markdown
Member Author

@greptile review

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 30, 2026

Greptile Summary

This PR consolidates the fumadocs root-route metadata into a shared siteMeta module and replaces a static siteOgImageUrl with a cache-busted version injected at build time. It also fixes a real bug in the old __root.tsx where og:image appeared twice pointing to different assets (siteOgImageUrl and /apple-touch-icon.png) and twitter:card had conflicting values — both of which would cause unpredictable social-media preview behavior depending on which entry a scraper picked up.

  • metadata.ts: new shared siteMeta array typed with TanStack Router's own MetaDescriptor; adds the previously missing og:image:alt and twitter:image:alt tags.
  • vite.config.ts: factory-function config that injects VITE_OG_IMAGE_VERSION from the git commit SHA (VERCEL_GIT_COMMIT_SHA) or a date fallback, so the OG image URL is automatically cache-busted on each build.
  • metadata.test.ts: Bun tests asserting that og:image / twitter:image each appear exactly once in siteMeta and carry the versioned URL.

Confidence Score: 5/5

Safe to merge — the change is a clean consolidation that removes duplicate conflicting meta tags and adds build-time cache-busting with no risky side effects.

The refactoring eliminates genuine duplicate/conflicting OG and Twitter tags from the old root route, introduces well-typed shared metadata, and adds meaningful test coverage. The cache-busting mechanism correctly derives the version from the git SHA at build time with a sensible date fallback, so the "dev" string only appears in local Bun test runs where Vite's define is not active.

No files require special attention.

Important Files Changed

Filename Overview
apps/fumadocs/src/lib/metadata.ts New shared siteMeta array using MetaDescriptor from TanStack Router; clean and correctly typed with satisfies
apps/fumadocs/src/lib/shared.ts Added siteOgImageVersion (from env var with "dev" fallback) and cache-busted siteOgImageUrl; version is overridden at build time via vite.config.ts define
apps/fumadocs/src/routes/__root.tsx Simplified to use siteMeta; removes the previous bug where duplicate og:image (siteOgImageUrl vs /apple-touch-icon.png) and conflicting twitter:card values coexisted
apps/fumadocs/vite.config.ts Switched to factory-function config; injects VITE_OG_IMAGE_VERSION at build time using VERCEL_GIT_COMMIT_SHA or date fallback via define
apps/fumadocs/src/lib/metadata.test.ts New Bun tests verify OG/Twitter image uniqueness and version param; uses dynamic siteOgImageUrl reference so no domain is hardcoded in assertions
apps/fumadocs/package.json Added bun test script to enable running the new metadata tests

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    ENV["Environment\nVITE_OG_IMAGE_VERSION\nVERCEL_GIT_COMMIT_SHA"]
    VITE["vite.config.ts\nloadEnv → ogImageVersion\n(git SHA | date fallback)"]
    DEFINE["Vite define\nimport.meta.env.VITE_OG_IMAGE_VERSION"]
    SHARED["shared.ts\nsiteUrl · siteOgImagePath\nsiteOgImageVersion · siteOgImageUrl"]
    META["metadata.ts\nsiteMeta: MetaDescriptor[]"]
    ROOT["__root.tsx\nhead() → { meta: siteMeta }"]
    TEST["metadata.test.ts\nbun test"]

    ENV --> VITE
    VITE --> DEFINE
    DEFINE --> SHARED
    SHARED --> META
    META --> ROOT
    META --> TEST
    SHARED --> TEST
Loading

Fix All in Claude Code

Reviews (10): Last reviewed commit: "fix: address final Greptile metadata nit..." | Re-trigger Greptile

Comment thread apps/fumadocs/src/lib/shared.ts Outdated
Comment thread apps/fumadocs/src/lib/metadata.test.ts Outdated
Comment thread apps/fumadocs/src/lib/metadata.ts Outdated
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 30, 2026

Greptile Summary

This PR extracts the fumadocs root route's inline head metadata into a shared siteMeta module and adds bun:test coverage for the OG/Twitter preview tags. It also fixes a pre-existing bug where the old __root.tsx declared duplicate and conflicting og:image / twitter:card entries with different values.

  • metadata.ts \u2014 new shared module exporting siteMeta and siteTitle; cleans up the duplicate OG/Twitter blocks that were in the root route.
  • shared.ts \u2014 siteOgImageUrl gains a static ?v=20260530 cache-buster to force social crawlers to re-fetch the image.
  • metadata.test.ts \u2014 new bun:test suite asserting the canonical OG image URL appears exactly once and that twitter:card is set to summary_large_image; the test regex hardcodes the production domain, which can fail when VITE_SITE_URL is overridden at test time.

Confidence Score: 4/5

Safe to merge; the core consolidation is correct and the duplicate-meta bug is properly resolved.

The metadata extraction and duplicate-tag cleanup are straightforward and correct. The main concerns are quality-oriented: the test regex hardcodes the production domain, the cache-buster version is a static date that must be bumped by hand, and the custom HeadMeta type drifts from TanStack Router's own type. None of these affect the runtime behaviour of the site today.

apps/fumadocs/src/lib/metadata.test.ts — the hardcoded domain in the regex is the most likely source of a future test failure worth addressing before it causes confusion in CI.

Important Files Changed

Filename Overview
apps/fumadocs/src/lib/metadata.ts New shared metadata module; correctly consolidates all head tags and removes duplicates from the root route. Custom HeadMeta type is looser than TanStack Router's own type.
apps/fumadocs/src/lib/metadata.test.ts New bun:test coverage for OG/Twitter metadata; the regex on line 18 hardcodes the production domain and will fail if VITE_SITE_URL is overridden at test time.
apps/fumadocs/src/lib/shared.ts Added a static cache-busting version suffix to siteOgImageUrl; the version string is a hard-coded date that must be manually bumped whenever the OG image changes.
apps/fumadocs/src/routes/__root.tsx Root route simplified to reference siteMeta; the old duplicate/conflicting OG blocks have been correctly removed.
apps/fumadocs/package.json Added test script ("bun test"); straightforward and correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["shared.ts"] --> B["metadata.ts\n(siteMeta: HeadMeta[])"]
    B --> C["__root.tsx\nhead() meta: siteMeta"]
    B --> D["metadata.test.ts\nbun:test assertions"]
    D --> E["og:image check"]
    D --> F["twitter:card check"]
    E --> G["regex: email-sdk.dev domain hardcoded"]
Loading

Fix All in Claude Code

Reviews (2): Last reviewed commit: "Consolidate site metadata and add previe..." | Re-trigger Greptile

Comment thread apps/fumadocs/src/lib/metadata.test.ts Outdated
Comment thread apps/fumadocs/src/lib/shared.ts Outdated
Comment thread apps/fumadocs/src/lib/metadata.ts Outdated
@leoisadev1
Copy link
Copy Markdown
Member Author

@greptile review

@leoisadev1
Copy link
Copy Markdown
Member Author

@greptile review

@leoisadev1
Copy link
Copy Markdown
Member Author

@greptile review

@leoisadev1
Copy link
Copy Markdown
Member Author

@greptile review

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