Uploaded image for project: 'Apache YuniKorn'
  1. Apache YuniKorn
  2. YUNIKORN-2256

Fix link error occurs when clicking link on page with trailing slash in the URL

    XMLWordPrintableJSON

Details

    Description

      How to reproduce ?

      1. navigating to https://yunikorn.apache.org/docs/design/user_group_resource_usage_enforcement
      2. pressing F5
      3. clicking on the link in the first paragraph of the document titled "user resource usage tracking in YuniKorn" results in a 404 not found error.

      The problem arises when pressing F5, as the page's URL automatically adds a "/", causing other links on the page to redirect to incorrect locations. For example, in step three, a 404 error occurs because the page redirects to https://yunikorn.apache.org/docs/design/user_group_resource_usage_enforcement/user_based_resource_usage_tracking. (Note that this still happened even if I cleared cache in browser so this is not a cache issue)
      However, this issue cannot be reproduced in the local development environment because pressing F5 does not automatically add a "/". I suspect this is a feature of the hosting service for the official website. Upon reviewing the Docusaurus documentation, I found a configuration option (https://docusaurus.io/docs/next/api/docusaurus-config#trailingSlash) that, when set to true, reproduces the same issue locally.

      IMO, we should set trailingSlash to true, and make all link anchor in markdown use relative markdown file path instead of url path. Doing this have three benefits.

      1. let docusaurus autogenerated the right url link in output html
      2. we can directly click the markdown link in code editor like VSCode to navigate to the right markdown file/paragraph
      3. Avoid the inconsistent behavior between link with/without trailing / by forcing trailingSlash to true, dev could easily found any url link issues in their laptop.

      [Note]: It seems that YUNIKORN-1380 verified that add customFields.trailingSlashes not work so that pr proposed absolute file paths to broken links. While I didn't find any setting named trailingSlashes in docusaurus document, I believe we could remove the setting too

      Attachments

        Issue Links

          Activity

            People

              brandboat Kuan Po Tseng
              brandboat Kuan Po Tseng
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: