[v2] Relative links on MD files doesn't work as expected
See original GitHub issue🐛 Bug Report
On v1 it works just fine.
When using the relative links it will work only when there is no / at the end of the URL. That means you will be fine if you navigate in the sidebar menu and open a relative link, however, if you share a link with someone, the browser (using Google Chrome) will add a / at the end of the URL and for this reason, relative links will not open anymore.
Version 2.0.0.alpha43
(Write your answer here.)
To Reproduce
(Write your steps here:)
- Create a
doc_test.mdwith a relative link todoc_test_2.mdon the same folder. - Open your docusarus website and open the new doc (doc_test) from the sidebar menu
- Access the relative link. It will work. The URL will be
localhost:3000/doc_test_2 - Now, go back, copy and paste the link for the
doc_testand open it in a new tab - The page now will have a
/and the end for the URL - Try to open again the link to
doc_test_2page - It will return not found. The URL will be
localhost:3000/doc_test/doc_test_2
Expected behavior
On v2, if you have a relative link for another MD file in the same folder, we expected that using [link](./anotherFile.md) will open the file/page.
Actual Behavior
The relative links don’t work if you are not navigating through the sidebar menu. If you share a link with someone, the relative link will brake.
Reproducible Demo
https://iqmetrix.github.io/hub.docs/docs/guides/configuring-the-sidebar/
If you go to the second paragraph, there is a link in the Have a configured Hub v2 development environment.. Check if you have the / at the end. If you have, the link will not work. Then, navigate back to the Configuring the Sidebar using the sidebar menu (you will see that there is no / anymore in the url) and try to click again the relative link, This time it will work.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)

Top Related StackOverflow Question
Actually, looks like the original file has
[Hub v2 development environment](./configuring-environments#hub-v2).and it was changed recently to[Hub v2 development environment](./configuring-environments.md#hub-v2).I don’t see the error anymore for this page.@yangshun you were right, the issue was because the link didn’t have the
.mdat the end since it wasn’t needed on v1 (the links on v1 always worked with these docs).Thanks for your time 😃
@prma85 Unfortunately, I was not able to reproduce this bug. Can you create a reproducible repo?