-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Add strict client-side routes - always respect presence or absence of a trailing slash #8693
Comments
Actually this is not "expected", it depends on the host and the behavior you want. You'll notice that Docusaurus website has a different behavior, and both URLs work without returning a 404: That behavior does not look wrong to me. You can choose to serve 1 URL, or both, as long as you have the canonical URL set correctly in page metadata, your SEO shouldn't be penalized. You could figure out how to configure your host to have the exact same behavior as Docusaurus if you want. Some hosts may not allow that easily though.
We choose to not use the This makes sense to be fault tolerant for me by default, and allow most sites to be served successfully from both URLs. Now we could add a Docusaurus option to make the client-side routing more strict in case you really want to ensure a single URL is successfully served. I'm going to requalify this issue as a feature request to discuss the introduction of strict client-side routes. Not sure what could be the public API for it. Do we need an extra config attribute? Or maybe it's better to reuse the
That's a different problem. You have links that are sensitive to trailing slashes. Our docs provide linking recommendations: https://docusaurus.io/docs/markdown-features/links In particular, we discourage the usage of regular html relative links ( |
Thank you for the quick response!
Fair enough. But the default non-configurable tolerant routing together with the broken links is the main issue (the flickering 404 is a less significant). So my options are:
Is there a way to override react router configuration? |
In any case that seems like a good to do
GitHub pages unfortunately does not provide any server-side option and not really an host I'd recommend if you want any kind of server-side control
yes In case you want to contribute (or simply make a PR POC with an hardcoded value), this is where you could add the
I don't think there's a way to do that in userland without core modifications. Maybe this could work but not sure: creating a Webpack plugin that modifies the |
* update docusaurus to 3.5 * geometric_representations.mdx first pass * wip geometric queries * mesh transformation first pass * adapt composite shape section * use file path rather than url paths prompted by facebook/docusaurus#8693 (comment) More info https://docusaurus.io/docs/markdown-features/links. * removed references to path transformation + fix a link * removed reference to collision detection pipeline * inject files + fix code snippets See Vrixyz#1 * use published strinject * chore: remove outdated sponsors * fix: remove nonexistant CompositeShape method --------- Co-authored-by: Sébastien Crozet <sebcrozet@dimforge.com>
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
When running a site with
trailingSlash: false
, the build creates an html file per page, then when going to that page URL with an added slash (e.g.site.com/page/
) the server returns a page not found with a 404 code as expected, but the client router is re-rendering the page as if the slash wasn't part of the URL, which in turn causes links to break.Reproducible demo
https://stylable.io/docs/guides/migration-v3/
Steps to reproduce
Runtime reference
link and click it to see a broken linkExpected behavior
Client should respect 404 page and either keep the 404 as is or redirect the URL to remove the slash
Actual behavior
Client is "fixing" routing without actually redirecting the URL resulting in broken links and 404 flicker
Your environment
Self-service
The text was updated successfully, but these errors were encountered: