Giter Site home page Giter Site logo

Comments (3)

slorber avatar slorber commented on May 2, 2024

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

CleanShot 2024-04-15 at 18 33 45


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.

John-fg avatar John-fg commented on May 2, 2024

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.

slorber avatar slorber commented on May 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.