Comments (5)
Can someone add the lowest of all low priorities labels for this pls. I almost didn't open the issue because it is working for every page and every language transition except the 404 page switching to English. As minor a bug as it can get.
But its funny, so...
from docs.
I've updated the title here because when we migrated to Vercel, we had to do some customization to even get our 404 page to work. So, I'm quite sure this is less of a "language selector" issue and more a 404 page issue. It might not be possible to improve the behaviour, but @delucis would know!
from docs.
It works on Starlight's own that is also deployed to Vercel and uses the same URL patterns for the locales. So it doesn't seem like a platform limitation.
Maybe something that differs on the overrides here?
from docs.
Yeah, the docs version does something a bit different for multilingual 404s to work around Vercel’s lack of support for multiple 404 pages. Starlight does this with some “fun” config in vercel.json
to support actually serving each language’s 404.html
but that approach was not viable in docs with so many redirects needed, so we just always serve the English page and switch out the main content.
The issue is that the language picker listens for a change event, but in this case nothing is changing. Could perhaps be addressed upstream by just running the redirect logic any time an option is chosen even if it is currently selected? I honestly don’t even know if that’s reliably possible (i.e. the distinction between a) user opens the picker then clicks away and b) user opens the picker then clicks the current item).
Or alternatively, the docs 404 could maybe just do this:
document.querySelector('starlight-lang-select select').value = `/${lang}/404/`;
That could be the simplest fix given this is a pretty rare use case.
from docs.
Hey friends,
Inspired by @delucis' code snippet, I came up with a possible solution to this issue:
- Add a
<script>
to docs 404 page - Check if current language in URL matches any option in the language selector
- If there's a match, apply the option's value to the language selector
Expected results:
- Allow the user to switch to English 404 page
- Resolve inconsistent displayed languages (main content of 404 vs language selector on the top right)
I've created a pull request. Would love to hear your feedback 🙂
from docs.
Related Issues (20)
- Improve alpine documentation on the use of the entrypoint or script HOT 4
- Improve documentation around `astro sync` HOT 6
- gitaction error,cant change es2022 version HOT 3
- Mention RSS Autodiscovery in RSS Guide HOT 2
- Sidebar reorganisation proposal HOT 9
- Add Zed (code editor) HOT 5
- Add utf8 to the language version of double-byte characters HOT 2
- ⚠️ Issue: installing fonts after installing tailwind, documentation guide seems out of date and following throws an error. HOT 3
- ⚠️ Issue - On demand rendering for protected page HOT 6
- Remove Tigris from the Astro Integrations HOT 2
- Entering pages through search includes unnecessary anchor
- Out of order streaming HOT 6
- ci: Upgrade `pnpm/setup-action` GitHub Action
- Missing description of different results of `paginate()` when using rest parameter in file-based routing HOT 2
- Unable to add icons to external links HOT 2
- After "npm create @keystatic@latest", "npm run build" fails HOT 1
- following your Docker setup by the letter ends in error HOT 1
- [astro-rss] [tutorial] [docs] --- Blog-tutorial breaks on step 5.4 --- '@astrojs/rss' No API Route handler exists for the method "GET" for the route "/rss.xml". HOT 1
- Outdated caution warning? HOT 1
- ⚠️ Issue Sample code for 'Building for static output (default)' throws a "Property 'render' does not exist on type 'never'" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docs.