Skip to content

fix(prerender): localize blog body links in prerendered HTML#40

Merged
miquelmatoses merged 1 commit into
mainfrom
fix/prerender-localized-links
May 28, 2026
Merged

fix(prerender): localize blog body links in prerendered HTML#40
miquelmatoses merged 1 commit into
mainfrom
fix/prerender-localized-links

Conversation

@miquelmatoses
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #38. The language-aware internal-link rewrite (localizeBlogLinks) reads window.__BLOG_ARTICLES__, but the prerender injected that global only post-capture, so during the React render it was undefined and localized pages kept English link URLs in the crawler-visible HTML. The rewrite only kicked in after client hydration (real users), leaving a SEO gap.

Fix: expose the article list via page.evaluateOnNewDocument before navigation, so the rewrite runs in the prerendered output too. The post-capture <script> still ships it for the hydrated client.

Validation (local build:full)

Prerendered /es/blog/personality-coaching-using-big-five-as-development-tool/ body links are now /es/blog/<slug> for targets with ES content. The one remaining /blog/<slug> link is the doubled-suffix dead slug — correct English fallback (not in the article list, and it 308-redirects to the live article).

  • pytest api/tests/test_seo.py api/tests/test_internal_links_integrity.py - 58 passed against fresh dist
  • CI frontend job (build:full)
  • Post-deploy: re-verify live /es/blog/... body hrefs

🤖 Generated with Claude Code

…ization

BlogArticlePage's language-aware internal-link rewrite reads
window.__BLOG_ARTICLES__, but the prerender injected that global only
post-capture, so during the React render it was undefined and localized
pages kept English link URLs in the crawler-visible HTML (the rewrite
only kicked in after client hydration). Expose the list via
evaluateOnNewDocument before navigation so the rewrite runs in the
prerendered output too. The post-capture <script> still ships it for the
hydrated client.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@miquelmatoses miquelmatoses merged commit 3df3d7c into main May 28, 2026
7 checks passed
@miquelmatoses miquelmatoses deleted the fix/prerender-localized-links branch May 28, 2026 22:18
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