-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Getting broken link on existing document path #7247
Comments
Hi, it may be a bit counter-intuitive, but file paths are resolved relative to (a) the current file or (b) the content path root. This means for a link like
Now, many people think we should also try to resolve it from the site root. However, it's not very portable, because when you translate the page by copying Markdown files, you would then need to manually update the links to point to the localized directory (which is I think there are several points of improvements we can make here, plus having some clearer docs. I would keep this open to remind me of the refactor. |
Yeah, it feels like a comprehensive doc showing different examples is in order. It gets extra confusing because |
Paths sans the |
I could use some help with a particular case, then, because even your description of how it should work isn't working for me. Directory structure:
I am trying to link from Visit the [REST API Gateway Quickstart](/gateways/rest-api/quickstart/quickstart.md) for an example. Here are the forms of the URL that I have tried (and all report an issue):
And, in fact, the error reporting is also saying it's resolving to a file path that really exists, for example, for the very last path in the list above, the error is:
Shouldn't "resolved as" be the full path that it's resolving to? Why does it report an error if that path actually exists? And, the thing I'm really struggling with is, just a few lines above in Visit the [REST API Gateway](/docs/gateways/rest-api/intro) product docs for an example. And that reports no error! |
Do you have |
Yes |
These paths show TWO (2) warnings during build:
These paths show no warnings during build, but the build still fails with a broken link error message:
UPDATE: I tried these last two again after running |
@dprothero a recent update we did: now The doc will be at This is likely why you saw an error on your site after upgrading |
Also, when the broken link checker reports this:
It doesn't mean that the markdown relative file link was resolved, it just prints the "relative path" being converted to an absolute path. The broken link checker doesn't know anything about resolving I understand how it can be a bit confusing here, but the "markdown file resolution" and the "broken links checked resolved as" are 2 different things somehow:
|
OK, so this was my root problem:
The other, somewhat confusing methods of URL resolution led me to believe I had reproduced the issue in the repo. Lessons learned:
So, this issue can be closed, unless you want to keep it open until the docs changes are released. |
That's probably not your fault, nobody reads long changelogs anyway 😅 After 2.0 launch the goal is to do such changes on major versions and have a dedicated blog post with clearer instructions and breaking change highlights |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Docusaurus is reporting a broken link for a path that exists if the Markdown file is in a directory of the same name as the Markdown file. (e.g.
/docs/tutorial/tutorial.md
) See the reproducible demo.Reproducible demo
https://github.com/dprothero/docusaurus-broken-links
Steps to reproduce
npx create-docusaurus@latest my-website classic
cd my-website
npm run build
This produces the following output:
Expected behavior
It should not report a broken link. It should build successfully.
Actual behavior
Your environment
Self-service
The text was updated successfully, but these errors were encountered: