seo: fix og:image localhost bug, simplify homepage redirect#309
Merged
Conversation
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>
✅ Deploy Preview for inquisitive-dolphin-3017bc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two SEO bugs blocking proper indexation and social previews for peachbitcoin.com.
helpers.js—getBaseUrl()returned an empty string when no Netlify env vars were set, andHOSTfell back tohttp://localhost:3000in dev mode. Productionog:image/twitter:imagewere rendering ashttp://localhost:3000/img/card.jpg(or as broken relative URLs depending on env). NowgetBaseUrl()falls back tohttps://peachbitcoin.comwhenever 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.htmlredirect that fired for English browsers (creating a duplicate URL inconsistent with the canonical<link>). Kept a simplified locale UX redirect fores/de/it/fr/ptbrowsers landing on/.Verified locally with
npm run prod:og:imagecontent:http://peachbitcoin.com/img/card-<hash>.jpg✓og:image:secure_urlandtwitter:image:https://peachbitcoin.com/img/card-<hash>.jpg✓localhost:3000references indist/✓dist/sitemap.xmlregenerated with 936 URLs across all 6 languages ✓Test plan
<head>shows absoluteog:imageURLs (nolocalhost)mainand prod deploy,https://peachbitcoin.com/sitemap.xmlreturns 200 and lists ~936 URLs/no longer redirects to/index.html/with browser locale set todestill redirects to/de//sitemap.xmlto Google Search Console🤖 Generated with Claude Code