Comments (4)
Just added a reproducer
from docusaurus.
Note: please next time create a smaller sandbox repro. It's much easier than dealing with a large custom site with repro instructions.
Agree there is something unexpected here, only happening for broken anchors (not pathnames).
Repro: https://stackblitz.com/edit/github-u4bsfu?file=src%2Fpages%2Findex.js,src%2Fpages%2Findex.module.css
<Link
to="/docs/intro/#getting-started"
>
{'/docs/intro/#getting-started'}
</Link>
<Link
to="/blog/welcome"
>
{'/blog/welcome'}
</Link>
<Link
to="/blog/welcome/"
>
{'/blog/welcome/'}
</Link>
[WARNING] Docusaurus found broken anchors!
Please check the pages of your site in the list below, and make sure you don't reference any anchor that does not exist.
Note: it's possible to ignore broken anchors with the 'onBrokenAnchors' Docusaurus configuration, and let the build pass.Exhaustive list of all broken anchors found:
- Broken anchor on source page path = /:
-> linking to /docs/intro/#getting-started
If we don't report /blog/welcome/
as broken path, there's no reason to report /blog/welcome/#existingAnchor
as a broken anchor.
But the pages themselves are accessible without trailing slash
That might be the case on your current host, or when using docusaurus serve
, but it doesn't mean it will be the case for every host. To keep your site portable it's better to always link to the canonical URL.
from docusaurus.
@slorber thank you for your response.
I tried to repro it in a smaller setup, but wasn't able to.
That might be the case on your current host, or when using docusaurus serve, but it doesn't mean it will be the case for every host. To keep your site portable it's better to always link to the canonical URL.
Yes, the web server might treat these requests differently, depending on the trailing slash. In our case, it's Cloudflare Pages and both seem to work.
Is there some documentation about which URL is the canonical one? With or without trailing slash?
from docusaurus.
Is there some documentation about which URL is the canonical one? With or without trailing slash?
If you choose trailingSlash: undefined
it depends if you put a trailing slash or not in your doc slugs. Otherwise it's the URL with/without the trailing slash according to the setting.
Otherwise your all site pages have this standard meta attribute that crawlers (Google) will use:
<link data-rh="true" rel="canonical" href="https://docusaurus.io/docs/installation">
And here's also some doc on how multiple hosts behave differently regarding trailing slash and static file hosting. As you will see, there's no standard behavior.
https://github.com/slorber/trailing-slash-guide
from docusaurus.
Related Issues (20)
- Problems with locale url on homepage and blog HOT 7
- Proposal: createSitemapItems hook - a sitemap equivalent to createFeedItems
- Blob storage files render dynamically HOT 1
- YAML code highlighting highlights much less than prismjs demo site HOT 1
- Include sidebar_class_name in category index metadata
- DocCards incorrectly pluralise the number of elements within them when only one is present HOT 2
- React 18.3 - new console warnings HOT 10
- Missing documentation for theme components HOT 3
- Updating past 3.1.1 breaks postCSS plugins customisation. Fully debugged, just needs fixing HOT 1
- `docusaurus start` command shows DeprecationWarning: The `punycode` module is deprecated. HOT 2
- Support asciidoc source code callouts in CodeBlock HOT 10
- broken styles after build HOT 4
- Migration of projects to new equipment HOT 1
- [Css Minimizer plugin] Build Broken after upgrading from 3.2.1 to 3.3.2 HOT 2
- Build failed after upgrade to 3.3.2 with a _category_.json contain slug attribute HOT 1
- Missing `:::` in Chinese translation. HOT 1
- the backtotopbutton only shows when scrolling up slightly after scrolling down HOT 5
- Trailing Slash Appended to Asset Files in Docusaurus 3.3.2 HOT 2
- Setting the `open` attribute on a `<details>` element should open it 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 docusaurus.