Skip to content

seo: fix og:image localhost bug, simplify homepage redirect#309

Merged
nuxblock merged 1 commit into
mainfrom
seo-fix-og-image-and-homepage-redirect
May 7, 2026
Merged

seo: fix og:image localhost bug, simplify homepage redirect#309
nuxblock merged 1 commit into
mainfrom
seo-fix-og-image-and-homepage-redirect

Conversation

@nuxblock
Copy link
Copy Markdown
Collaborator

@nuxblock nuxblock commented May 7, 2026

Summary

Fixes two SEO bugs blocking proper indexation and social previews for peachbitcoin.com.

  • helpers.jsgetBaseUrl() returned an empty string when no Netlify env vars were set, and HOST fell back to http://localhost:3000 in dev mode. Production og:image / twitter:image were rendering as http://localhost:3000/img/card.jpg (or as broken relative URLs depending on env). Now getBaseUrl() falls back to https://peachbitcoin.com whenever the build environment can't supply a real branch URL, so prod builds always emit absolute social-preview URLs.
  • src/index.pug — Removed the broken //index.html redirect that fired for English browsers (creating a duplicate URL inconsistent with the canonical <link>). Kept a simplified locale UX redirect for es / de / it / fr / pt browsers landing on /.

Verified locally with npm run prod:

  • og:image content: http://peachbitcoin.com/img/card-<hash>.jpg
  • og:image:secure_url and twitter:image: https://peachbitcoin.com/img/card-<hash>.jpg
  • Zero localhost:3000 references in dist/
  • dist/sitemap.xml regenerated with 936 URLs across all 6 languages ✓

Test plan

  • Netlify deploy preview builds successfully and the preview's <head> shows absolute og:image URLs (no localhost)
  • After merge to main and prod deploy, https://peachbitcoin.com/sitemap.xml returns 200 and lists ~936 URLs
  • Run https://peachbitcoin.com through the Facebook Sharing Debugger — confirm card image renders
  • Spot-check English homepage: visiting / no longer redirects to /index.html
  • Spot-check non-English browser: visiting / with browser locale set to de still redirects to /de/
  • After deploy, submit /sitemap.xml to Google Search Console

🤖 Generated with Claude Code

helpers.js: getBaseUrl() now falls back to https://peachbitcoin.com when
no Netlify env vars are set, so production builds emit absolute social
preview URLs instead of http://localhost:3000/... or empty-host relative
URLs.

src/index.pug: remove broken / → /index.html redirect that created a
duplicate URL for English visitors; keep simplified locale UX redirect
for non-English browsers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for inquisitive-dolphin-3017bc ready!

Name Link
🔨 Latest commit 858f2c3
🔍 Latest deploy log https://app.netlify.com/projects/inquisitive-dolphin-3017bc/deploys/69fc67d58d4367000844d3b4
😎 Deploy Preview https://deploy-preview-309--inquisitive-dolphin-3017bc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nuxblock nuxblock merged commit df70c08 into main May 7, 2026
5 checks passed
@nuxblock nuxblock deleted the seo-fix-og-image-and-homepage-redirect branch May 7, 2026 10:33
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