-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
OnBrokenAnchors throws error for for anchors on different page. #9763
Comments
please create a repro using docusaurus.new. The repro steps are too vague to act on. We don't even know the content of the files. We'll reopen if a repro is provided |
I've opened a repo at https://codesandbox.io/p/devbox/great-brahmagupta-q5kf5c. However, since the error is thrown only during a build, I'm unable to test or duplicate the error. Is there a way to trigger a build on the sandbox? |
thanks, will check later
yes you can run "npm run build" in the sandbox normally |
I see; I just needed to open a second terminal. I was able to reproduce the error. |
Although it doesn't seem not super practical, it is working as intended, cf my comment here: #9721 (comment) You need to use Thanks to (#9732), when Docusaurus 3.1.1 is released (later this week?) you should be able to use Docusaurus Link component to make it more convenient in practice to create anchors: import Link from '@docusaurus/Link';
<Link id="test-link-anchor"/> We'll investigate later how we could make it possible to automatically collect anchors so that you don't have to care about it, but for now you have to collect all anchors manually for the broken link checker to know about them, or use the |
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 like this,
[A link to an anchor on another page](/docs/not-this-page/#some-anchor)
, enablingonBrokenAnchors: 'throw'
causes builds to fail.Reproducible demo
No response
Steps to reproduce
not-this-page.js
, with an anchor on it.this-page.js
, that links to the anchor onnot-this-page.js
. Use relative path syntax.Expected behavior
Legitimate links to anchors on another page should not throw an error. Build should succeed.
Actual behavior
Legitimate links to anchors on another page throw an error; builds fail.
Your environment
Self-service
The text was updated successfully, but these errors were encountered: