Skip to content

fix(seo): set metadataBase so og:image resolves to the live domain#135

Merged
mansyur007 merged 1 commit into
mainfrom
fix/opengraph-metadata-base
Jul 23, 2026
Merged

fix(seo): set metadataBase so og:image resolves to the live domain#135
mansyur007 merged 1 commit into
mainfrom
fix/opengraph-metadata-base

Conversation

@mansyur007

Copy link
Copy Markdown
Owner

Follow-up to #133 — the OG image shipped, but production was still advertising it on a URL no scraper can reach.

After #133 deployed, https://testforge.emha.space/ served:

<meta property="og:image" content="http://localhost:3000/opengraph-image?..."/>
<meta name="twitter:image" content="http://localhost:3000/opengraph-image?..."/>

Next resolves relative metadata image URLs against metadataBase; with none set it falls back to http://localhost:3000. LinkedIn, WhatsApp and Slack can't fetch that, so the card would still have rendered without an image — the exact thing #133 was meant to fix.

FixmetadataBase in the root layout, taken from NEXT_PUBLIC_BASE_URL, which docker-compose.prod.yml already bakes as https://testforge.emha.space at Docker build time (build.args). Falls back to http://localhost:3000 for local dev. No compose change needed.

Verified — local production build with NEXT_PUBLIC_BASE_URL=https://testforge.emha.space, then npm start:

<meta property="og:image" content="https://testforge.emha.space/opengraph-image?7d2715537c8f889b"/>
<meta name="twitter:image" content="https://testforge.emha.space/opengraph-image?7d2715537c8f889b"/>

🤖 Generated with Claude Code

After the OG image shipped, production served
og:image = http://localhost:3000/opengraph-image — Next resolves relative
metadata image URLs against metadataBase, and without one it falls back to
localhost. LinkedIn, WhatsApp and Slack cannot fetch that, so the card stayed
imageless.

Sets metadataBase from NEXT_PUBLIC_BASE_URL, which docker-compose.prod.yml
already bakes as https://testforge.emha.space at Docker build time.

Verified against a local production build with NEXT_PUBLIC_BASE_URL set:
og:image and twitter:image now both point at https://testforge.emha.space.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mansyur007
mansyur007 merged commit 1e51d37 into main Jul 23, 2026
1 of 2 checks passed
@mansyur007
mansyur007 deleted the fix/opengraph-metadata-base branch July 23, 2026 14:49
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