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)
- View Transitions Script Behavior HOT 1
- Double/triple click headings copy issues HOT 2
- Getting errors creating a new project
- The remark config documentation misses some important information HOT 3
- Clarify how to implement social image URLs HOT 4
- Missing explanation about "themes" from ShikiConfig in syntax highlighting HOT 2
- ⚠️ Issue - The implementation of themes from Shiki is not working properly. HOT 1
- Add a bit more help text to client:only description
- Give us feedback form Appearance is not in line with Astro Doc Styling HOT 1
- RTL Docs `Inline Code Snippet` need to be always LTR.
- Deploying to GitHub Pages is problematic/flakey HOT 1
- Prettier plugin content is incorrect. HOT 1
- Middleware: unclear that reading cookies/headers behaviour
- Improve documentation on fallback content for slots HOT 3
- Unclear refactoring task
- Script Tag CDNs with View Transitions
- `prose-p:text-justify` makes recipe less usable HOT 1
- ⚠️ Issue @astro/mdx keeps crushing due to rehype dependency HOT 3
- Document `?url` usage in Imports docs HOT 1
- Tutorial says that the rss.xml can't be seen in development but it actually can be HOT 2
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.