question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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:)

  1. Create a doc_test.md with a relative link to doc_test_2.md on the same folder.
  2. Open your docusarus website and open the new doc (doc_test) from the sidebar menu
  3. Access the relative link. It will work. The URL will be localhost:3000/doc_test_2
  4. Now, go back, copy and paste the link for the doc_test and open it in a new tab
  5. The page now will have a / and the end for the URL
  6. Try to open again the link to doc_test_2 page
  7. 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:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
prma85commented, Feb 25, 2020

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 .md at the end since it wasn’t needed on v1 (the links on v1 always worked with these docs).

Thanks for your time 😃

0reactions
lex111commented, Feb 25, 2020

@prma85 Unfortunately, I was not able to reproduce this bug. Can you create a reproducible repo?

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub relative link in Markdown file - Stack Overflow
Starting today, GitHub supports relative links in markup files. ... look at the raw source of the README.md of Markdown itself(!), relative paths...
Read more >
relative links in markdown to the current directory or via subdir ...
Relative links in markdown files in regular repositories given as "./" or "subdir/../" do not point to the tree view of the directory...
Read more >
Markdown relative link to image and other readme does ... - Jira
Same issue as others mentioned. Relative URLs do not work when the README is displayed in the directory/overview. But works if I am...
Read more >
Broken links in relative path mode on move/rename
I'm using a single vault attachment folder/relative path to file /MDlinks so embedded images will still work with most MD editors like ...
Read more >
Using relative paths to link handbook pages
I add about-sourcegraph/index.md because that is the file path of the page I want to link to. You can see “index” in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found