Skip to content

Improve support for trailing slashes #2654

Closed

Description

@kripod

🚀 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.

Activity

  1. added
    feature
    status: needs triage
    on Apr 24, 2020
  2. davidhagg commented on Apr 30, 2020

    @davidhagg

    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.

  3. dotansimha commented on May 19, 2020

    @dotansimha

    @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 :(

  4. awentzel commented on May 27, 2020

    @awentzel

    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.

  5. yangshun commented on Jun 5, 2020

    @yangshun
    Contributor

    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

  6. removed
    status: needs triage
    on Jun 5, 2020
  7. slorber commented on Oct 1, 2020

    @slorber
    Collaborator

    Closing in favor of #3372

  8. added
    domain: trailing slash
    on Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain: trailing slashfeature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions