Markdown links point to root-level file when Markdown file with same filename exists #11099
Open
6 of 7 tasks
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
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
When linking to a file within the documentation, the link sometimes resolves to an unintended file in the root docs directory rather than the expected file in the current or relative directory.
For example, suppose a page contains a link like
[See this](index.mdx)
, and the current directory also contains a file named index.mdx. If a root-level docs/index.mdx also exists, the link will incorrectly point to the root file instead of the intended one in the current directory.This behavior is not limited to index.mdx; it occurs with other filenames as well. It seems that the link resolution logic prioritizes the root docs directory over the relative path, which leads to incorrect navigation and potential confusion for users.
Workaround
If you start a link with
./
([See this](./index.mdx)
), then the issue doesn't occur. However, I don't think this is a solution because, as far as I know, using./
isn't necessary when pointing to pages in the current directory.Reproducible demo
https://clinquant-beijinho-49680d.netlify.app/docs/latest/scalardb-cluster/getting-started-with-scalardb-cluster
Steps to reproduce
[index](index.mdx)
to the file.npm run build
.npm run serve
.docs/index.mdx
, which shows the basic text that you added in step 1.Expected behavior
I was expecting to be routed to the page with the same filename in the subdirectory that I was in.
Actual behavior
I was routed to the root-level (docs) page with the same filename as that in the subdirectory that I was in.
Your environment
Self-service
The text was updated successfully, but these errors were encountered: