You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
onBrokenLink ignores relative paths without file extension #3380
Let's say you have a file Overview.mdx and reference it from another document.
[Overview](./Overview) <-- fails silenty at runtime (leads to 404)
[Overview](./Overview.md) <-- fails at build time correctly because there is an .md file not .mdx
[Overview](./Overview.mdx) <-- works great
Can you tell me which link should I put in the docusaurus 2 site you mentioned?
Preferably, if you can open a PR where the deploy preview does show a broken link, yet it was not catched at build time, it's the perfect repro to fix the bug for me :)
@slorber hi, sorry if it's not clear enough. The issue is about using relative link without the .md extension. It's actually mentioned here. But here is the PR anyway.
So if you open the Contribution page and click the "Getting started" link - it leads to 404. And it's not reported by broken links checker.
If you navigate to the contributing page, the trailing slash won't be added by Netlify, and you'll find the "Getting started" link to resolve correctly.
I'd like to find a solution to this trailing slash problem but it's not clear what's the best solution yet, and it can be a breaking change for many sites
In the meantime, the workaround is to avoid relative links if your hosting solution add this trailing slash. Docs should rather link using .md extensions and relative paths, as it will work fine with versioning, and also allow to navigate them through github interface.
Activity
slorber commentedon Sep 1, 2020
Hi,
Will check this later.
Can you tell me which link should I put in the docusaurus 2 site you mentioned?
Preferably, if you can open a PR where the deploy preview does show a broken link, yet it was not catched at build time, it's the perfect repro to fix the bug for me :)
Remove .md file extension from Installation link
Remove an .md extension from Installation link
maksnester commentedon Sep 3, 2020
@slorber hi, sorry if it's not clear enough. The issue is about using relative link without the
.mdextension. It's actually mentioned here. But here is the PR anyway.So if you open the Contribution page and click the "Getting started" link - it leads to 404. And it's not reported by broken links checker.
slorber commentedon Sep 3, 2020
Hey.
The problem is due to the hosting environment that add a trailing / automatically with a 302 redirect on initial load.
Due to this trailing slash, the relative link resolution is different:
If you navigate to the contributing page, the trailing slash won't be added by Netlify, and you'll find the "Getting started" link to resolve correctly.
I'd like to find a solution to this trailing slash problem but it's not clear what's the best solution yet, and it can be a breaking change for many sites
We'll track this issue here: #3372
In the meantime, the workaround is to avoid relative links if your hosting solution add this trailing slash. Docs should rather link using .md extensions and relative paths, as it will work fine with versioning, and also allow to navigate them through github interface.