Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(i18n): localised index pages are overwritten #10250

Merged
merged 3 commits into from
Feb 28, 2024

Conversation

log101
Copy link
Contributor

@log101 log101 commented Feb 27, 2024

Closes #10226

This PR fixes the overwriting of localised index pages with redirects:

  • Fallback pages are checked before rendering. generatePath function now checks if there is already a page on the same path among non-fallback pages (option.allPages) before rendering a fallback page. And skipping if a page with the same path is found, this means the index page is localised and fallback page should not be rendered.
  • Fallback pages are not rendered twice. getPathsForRoute function does not add fallback routes to be list of rendered as they are already handled by eachRouteInRouteData function. Otherwise this causes localised index pages to be overwritten with the original index page.

Testing

  • New fixture is added: i18n-routing-fallback-index
  • Localised index page's content is checked

Notes

  • Localised index pages are searched inside option.allPages, this might not be the right place.

Docs

N/A, bugfix

Copy link

changeset-bot bot commented Feb 27, 2024

🦋 Changeset detected

Latest commit: 7d0302f

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Feb 27, 2024
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking the time to fix this issue

@ematipico ematipico merged commit 57655a9 into withastro:main Feb 28, 2024
13 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Feb 28, 2024
peng added a commit to peng/astro that referenced this pull request Mar 4, 2024
* main: (327 commits)
  [ci] format
  fix(node): listen on 0.0.0.0 if server.host is set to true (withastro#10282)
  [ci] format
  fix(dev): cosider `base` when special-casing `/_image` (withastro#10274)
  [ci] format
  update login flow to support Brave (withastro#10258)
  [ci] format
  improve link command (withastro#10257)
  Updates deprecated Node.js 16 github actions (withastro#10270)
  Fix Vitest check fail again (withastro#10266)
  [ci] format
  Adds auto completion of `astro:` events when adding or removing event listeners on `document` (withastro#10263)
  Update Vite to latest (withastro#10259)
  [ci] release (withastro#10236)
  [ci] format
  fix(i18n): localised index pages are overwritten (withastro#10250)
  fix: change strategy for route caching (withastro#10248)
  Fix TypeScript type definitions for `Code` component (withastro#10251)
  chang changeset (withastro#10253)
  Removes morph animations when setting transition:animate=none (withastro#10247)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

i18n fallback : existing translated files are not built
2 participants