feat(i18n): add central route map and SEO links with contextual LanguageSwitch - #6
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0fc2c0567
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const baseUrl = "https://rocketdeploy.dev"; | ||
| const { pl: plPath, en: enPath } = getRoutePaths(routeKey, routeParams); |
There was a problem hiding this comment.
Guard BaseLayout against missing routeKey
BaseLayout now unconditionally calls getRoutePaths(routeKey, routeParams), but routeKey is only required by convention; there are still callers like src/layouts/CaseStudyLayout.astro that render <BaseLayout ...> without a routeKey, which will make routes[routeKey] undefined and throw during build/render for any page that uses that layout. Either update those callers to pass routeKey/routeParams or add a defensive fallback here to avoid a runtime crash when a layout is missing the new prop.
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Motivation
hreflangandcanonicaltags and a contextual language switch that maps the current page between languages.Description
src/i18n/routes.tsexportinggetRoutePaths,RouteKeyand a dynamic builder for case study routes.src/layouts/BaseLayout.astroto acceptrouteKeyand optionalrouteParams, and to generatecanonicalandhreflangtags using the route map and basehttps://rocketdeploy.dev.src/components/LanguageSwitch.astroandsrc/components/Header.astroto accept and forwardrouteKey/routeParamsand to produce contextual PL/EN links viagetRoutePaths.src/pages/plandsrc/pages/ento pass appropriaterouteKey(androuteParamsfor dynamiccaseStudypages) toBaseLayoutso routing and SEO metadata are computed centrally.Testing
Codex Task