Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect document reference path #2093

Closed
ataft opened this issue Dec 6, 2019 · 3 comments
Closed

Incorrect document reference path #2093

ataft opened this issue Dec 6, 2019 · 3 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers

Comments

@ataft
Copy link
Contributor

ataft commented Dec 6, 2019

🐛 Bug Report

Document references are incorrect when there's a forward slash at the end of the URL. For example, document references in https://learn.flexitanalytics.com/docs/getting-started work, but do NOT work in https://learn.flexitanalytics.com/docs/getting-started/.

It appears that even when I go to https://learn.flexitanalytics.com/docs/getting-started, without the forward slash, that a forward slash is being added. If you click on "Getting Started" in the sidebar, then the forward slash is removed and then references work.

This issue only happens in production, not locally, so I'm guessing that the forward slash is being added by the domain provider.

Have you read the Contributing Guidelines on issues?

Yes.

To Reproduce

  1. Go to https://learn.flexitanalytics.com/docs/getting-started, it should add a / at the end
  2. Scroll to the Administration section "Read the full guide: Administration" and click the link, which does not work.
  3. Click on "Getting Started" in the sidebar, there should be no / at the end
  4. Scroll to the Administration section again and click the link, which should work now

Expected behavior

Document references should work, regardless of / or not

Actual Behavior

Doc references do not work with / at end of URL

Reproducible Demo

The repository is https://github.com/ataft/flexit-docs, but the issue does not happen locally. It's only happening on Github Pages using a Custom Domain. Follow the steps in "To Reproduce" above as the demo.

@ataft ataft added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Dec 6, 2019
@endiliey
Copy link
Contributor

endiliey commented Dec 6, 2019

You are referencing the document wrong. You are using relative url which is very domain provider specific (eg: netlify always append slash at end of url, and it might not). It just happens that our local dev server doesnt do that appending.

Just checking your markdown. You are doing this

[Administration Guide](administration#securing-content)

You are using relative url. Which doesnt even work on GitHub as well. Going to https://github.com/ataft/flexit-docs/blob/master/docs/readme.md and clicking administration guide redirect to https://github.com/ataft/flexit-docs/blob/master/docs/administration#securing-content which is 404

Read out https://v2.docusaurus.io/docs/markdown-features#referencing-other-documents

If you want to reference another document file, you should use the name of the document you want to reference. Docusaurus will convert the file path to be the final website path (and remove the .md).

One benefit of this approach is that the links to external files will still work if you are viewing the file on GitHub.

You can see it in action here https://github.com/facebook/docusaurus/blob/master/website/docs/using-plugins.md

Plugins are the building blocks of features in a Docusaurus 2 site. Each plugin handles its own individual feature. Plugins may work and be distributed as part of bundle via [presets](presets.md).

It works on GitHub, and doesnt broke in https://v2.docusaurus.io/docs/next/using-plugins

@endiliey endiliey closed this as completed Dec 6, 2019
@ataft
Copy link
Contributor Author

ataft commented Dec 6, 2019

I put an .md on all my references and that cleared everything up.

When I first started with Docusaurus, I had an .md on my first reference and it didn't work. I found a few issues (#1137 and #1261) and removed the .md, then it worked. I'm sure the issue was something else, or maybe I'm taking crazy pills.

Anyhow, things look good now. Thanks!!!

@endiliey
Copy link
Contributor

endiliey commented Dec 6, 2019

Aha, i guess its old v1 bug which should've been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants