fix(prerender): localize blog body links in prerendered HTML#40
Merged
Conversation
…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>
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
Follow-up to #38. The language-aware internal-link rewrite (
localizeBlogLinks) readswindow.__BLOG_ARTICLES__, but the prerender injected that global only post-capture, so during the React render it wasundefinedand 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.evaluateOnNewDocumentbefore 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/es/blog/...body hrefs🤖 Generated with Claude Code