Skip to content

fix(seo): set metadataBase so OG images resolve to production#16

Merged
Manuel10i merged 1 commit into
mainfrom
fix/metadata-base-og-images
Jul 5, 2026
Merged

fix(seo): set metadataBase so OG images resolve to production#16
Manuel10i merged 1 commit into
mainfrom
fix/metadata-base-og-images

Conversation

@Manuel10i

Copy link
Copy Markdown
Owner

Problem

On the marketing pages (home, /map, /compare, /best-time, feature pages) the file-based opengraph-image route emitted:

og:image      = http://localhost:3000/opengraph-image?...
twitter:image = http://localhost:3000/opengraph-image?...

No metadataBase was set, so Next.js resolves relative metadata image URLs against the dev fallback http://localhost:3000. Result: broken social share previews everywhere the site is shared (WhatsApp, X/Twitter, LinkedIn, Facebook) — no image, and an http://localhost link.

Destination pages were unaffected (they build an absolute https://packedplaces.com/api/og/... URL by hand).

Fix

  • Set metadataBase: new URL("https://packedplaces.com") in the root generateMetadata, resolving OG/Twitter image URLs to the production origin site-wide.
  • Remove the alternates.languages hreflang block. Every language is served from the same URL (locale is negotiated, not path-prefixed), so the en/de/es/fr/x-default entries all pointed at https://packedplaces.com and signalled nothing to Google. Destination pages with distinct de/en URLs keep their own alternates.

Verify

  • npx tsc --noEmit passes.
  • After deploy: curl -s https://packedplaces.com | grep og:image should show https://packedplaces.com/opengraph-image....

First of a small SEO/security cleanup sweep; separate PRs follow for canonical tags + sitemap and for security headers.

The file-based opengraph-image route emitted og:image/twitter:image URLs
pointing at http://localhost:3000, so social previews (WhatsApp, X,
LinkedIn, Facebook) were broken on all marketing pages. Setting
metadataBase resolves those relative URLs against the production origin.

Also drops the hreflang language alternates: every language is served from
the same URL, so per-language alternates all pointed here and signalled
nothing. Destination pages with distinct de/en URLs keep their own.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Manuel10i Manuel10i merged commit 5419591 into main Jul 5, 2026
2 checks passed
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