docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

Improve support for trailing slashes

Open kripod opened this issue 6 years ago • 5 comments

🚀 Feature

Add a preferTrailingSlashes option (or something similar) to docusaurus.config.js.

Have you read the Contributing Guidelines on issues?

Yes.

Motivation

If hosting documentation on GitHub Pages, a trailing slash appears in the URL when navigating to a specific Docusaurus page from outside the docs.

For instance, https://glaze.js.org/docs/introduction sends the visitor to https://glaze.js.org/docs/introduction/.

In order to keep consistency, there should be an option for sidebar links to have a trailing comma by default, without resorting to a longer sidebar item format.

kripod avatar Apr 24 '20 18:04 kripod

I've noticed that the trailing slash potentially destroys internal links as well since the relative root is different. Don't know if this is a separate bug or a side effect.

davidhagg avatar Apr 30 '20 08:04 davidhagg

@davidhagg Same here. I'm deploying to GH Pages (v2, latest alpha). It seems like it adds / always to all pages, so relative links are broken :(

dotansimha avatar May 19 '20 07:05 dotansimha

This also breaks Azure Front Door routes. I migrated a Docusaurus + GitHub Pages site to Azure Web Apps behind an Azure Front Door and all site pages without a trailing / redirect by Front Door presumably correctly, but the Docusaurus compiled application routes to a / and when it does this is referrer is the backend server name not the custom domain name with the URL and trailing / appended.

It appears, also there may be something deployed in the root that does dynamic routing, otherwise, I'd expect Docusaurus compiler to simply create all URL paths with / or without.

I like this feature request and hope it addresses my issue as well.

awentzel avatar May 27 '20 20:05 awentzel

I think we should take a stance here and add trailing / to all Docusaurus-generated URLs. This will bridge the differences during development and deployed. cc @lex111 @slorber

yangshun avatar Jun 05 '20 11:06 yangshun

Closing in favor of https://github.com/facebook/docusaurus/issues/3372

slorber avatar Oct 01 '20 14:10 slorber