Comments (3)
Trailing slashes should only be used for actual directories.
No that's not how this feature is designed sorry. There's not even a concept of "directory" in Docusaurus, only "docs categories".
FYI we recently fixed a bug related to trailing slash not being applied to sitemap:
#9920
301 redirect is a server/host concern, not a Docusaurus concern. If your host serves 301 instead of 200, then you have to configure your host so that it serves 200 instead of 301.
Those links are standard HTML relative links. If you want your pages to end with /
then your links must contain that trailing slash too, that's how HTML links work.
[table 1](./mydoc#table-1)
[table 2](mydoc2#table-2)
We have a whole doc section explaining why we don't recommend those kind of link, in particular due to the trailingSlash portability.
https://docusaurus.io/docs/markdown-features/links
I'm closing because no concrete repro was provided, this issue is quite messy, and to me this works as intended unless proven otherwise.
If you want to discuss things further please create a runnable https://docusaurus.new/stackblitz repro
from docusaurus.
So how would you configure the most used web server, Apache 2, not to use 301 redirects? Apache adds slashes by default: DirectorySlash On
.
The root cause seems to be that sitemap.xml does not contain slashes while Apache requires slashes. A workaround would be to create sitemap.xml with trailing slashes as an option.
Stackblitz obviously does not replicate a real world setup. Do you mean you can't replicate that sitemap.xml does not generate trailing slashes?
from docusaurus.
So how would you configure the most used web server, Apache 2, not to use 301 redirects?
This is not an option we recommend using. I'd suggest using Vercel or Netlify, and if you cannot GitHub pages.
If you want to use Apache2, then it's your responsibility to figure out to configure it to serve a static deployment appropriately. I don't use Apache and I can't advise you how to configure it, although I'm pretty sure I already saw people using it successfully.
Docusaurus is only responsible for building a static deployment, not hosting it.
If you think our sitemap has a bug, then provide a repro and show what's the actual sitemap and what's the expected sitemap, given a fixed set of options. The expected behavior is that the sitemap contains URLs with/without /
depending on the trailingSlash
config, and the sitemap is expected to target the exact canonical URL of pages so if pages have /
in their canonical URL, the sitemap should also contain a trailing slash.
from docusaurus.
Related Issues (20)
- Index pages cannot be generated with an automatically generated siderbar HOT 1
- Document solution to "docs last update" date being rendered incorrectly when published through Vercel
- Customizing admonitions not work HOT 3
- When testing on StrictMode, the bar remains on the top HOT 1
- Node.js building getting stuck HOT 2
- Updating to @mdx-js/react 3.0.1 causes admonition blocks to stop rendering colored box HOT 8
- The <!--truncate--> line in my long blog post on the initialized website is not causing the blog post size to be limited. HOT 1
- blogTitle not working HOT 4
- Algolia Contextual Search Generates Incorrect FaceFilters HOT 6
- Multi-Instance Routes Not Working in v3.2.1 HOT 3
- Home page renders twice, one below the other. HOT 1
- Details elements aren't searchable - a11y issue HOT 8
- WARNβ 1 deprecated subdependencies found: [email protected] HOT 1
- npm run build fails when nmetadata are missing HOT 3
- Broken link transformation HOT 2
- Ability to Skip Homepage and Directly Access Feature Page HOT 1
- Light/Dark Mode issues on older versions of Safari 12,13, and 14 HOT 3
- Problems with locale url on homepage and blog HOT 5
- Proposal: createSitemapItems hook - a sitemap equivalent to createFeedItems
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.