File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { docsMenu } from '@/config/menu/docs';
88import { apiMenu } from ' @/config/menu/api' ;
99import { resourcesMenu } from ' @/config/menu/resources' ;
1010import { DEFAULT_VERSION , VERSION_PREFIXES } from ' @/config/versions' ;
11+ import LocalizedLink from ' @components/patterns/LocalizedLink/LocalizedLink.astro' ;
1112import type { LanguageCode } from ' @i18n/locales' ;
1213
1314export async function getStaticPaths() {
@@ -204,6 +205,10 @@ const { prev, next } = getAdjacentPages(
204205const editUrl = isTranslation
205206 ? ` https://github.com/expressjs/expressjs.com/blob/main/docs/i18n.md `
206207 : ` https://github.com/expressjs/expressjs.com/edit/main/${page .filePath } ` ;
208+
209+ // Shared collections (api/blog) are compiled once, so their in-content links are
210+ // baked to the default language. Re-localize them per render-language.
211+ const isSharedCollection = page .collection === ' api' || page .collection === ' blog' ;
207212---
208213
209214<DocLayout
@@ -215,5 +220,5 @@ const editUrl = isTranslation
215220 prev ={ prev }
216221 next ={ next }
217222>
218- <Content />
223+ { isSharedCollection ? <Content components = { { a: LocalizedLink } } /> : < Content /> }
219224</DocLayout >
You can’t perform that action at this time.
0 commit comments