feat: enhance internal link localization for blog posts and standard pages - #381
Open
danielmarv wants to merge 1 commit into
Open
feat: enhance internal link localization for blog posts and standard pages#381danielmarv wants to merge 1 commit into
danielmarv wants to merge 1 commit into
Conversation
…pages Signed-off-by: Ntege Daniel <danientege785@gmail.com>
✅ Deploy Preview for open-elements ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
github-actions
Bot
requested review from
Jexsie,
Ndacyayisenga-droid,
hendrikebbers and
sebtiem
July 31, 2026 17:00
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.

This pull request introduces a locale-aware system for internal links in markdown-rendered content. Authors now write internal links without a locale prefix, and the renderer automatically adds the correct locale prefix based on the current page's locale. This ensures that links resolve correctly for both English and German content, prevents double-prefixing, and leaves external links, anchors, and asset paths unchanged.
Locale-aware internal link handling:
localizeInternalLinksfunction insrc/lib/markdown.tsto rewrite locale-neutral internal links so they resolve within the rendered locale, using the correct/de/or/en/prefix as needed.localizeInternalLinksafter HTML conversion, ensuring all internal links in page content are correctly localized (getPostBySluginsrc/lib/markdown.ts, src/lib/markdown.tsR787-R790;loadPageDatainsrc/app/[locale]/[...rest]/page.tsx, src/app/[locale]/[...rest]/page.tsxL98-R99; import added, src/app/[locale]/[...rest]/page.tsxR9)Documentation updates:
docs/04-adding-blog-post.mdto instruct authors to write locale-neutral internal links and describe the new automatic locale prefixing behavior.Supporting constants and patterns:
src/lib/markdown.tsto support the new link rewriting logic.