-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(v2): improve broken links error message (#3569)
* improve broken links message * improve broken links error message: include help message for frequent broken links, usually found in layout
- Loading branch information
Showing
3 changed files
with
126 additions
and
13 deletions.
There are no files selected for viewing
62 changes: 56 additions & 6 deletions
62
packages/docusaurus/src/server/__tests__/__snapshots__/brokenLinks.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,64 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`brokenLinks getBrokenLinksErrorMessage 1`] = ` | ||
"Broken links found! | ||
"Docusaurus found broken links! | ||
- Page path = /docs/mySourcePage: | ||
-> link to ./myBrokenLink (resolved as: /docs/myBrokenLink) | ||
-> link to ../otherBrokenLink (resolved as: /otherBrokenLink) | ||
Please check the pages of your site in the list bellow, and make sure you don't reference any path that does not exist. | ||
Note: it's possible to ignore broken links with the 'onBrokenLinks' Docusaurus configuration, and let the build pass. | ||
Exhaustive list of all broken links found: | ||
- Page path = /otherSourcePage: | ||
-> link to /badLink | ||
- On source page path = /docs/mySourcePage: | ||
-> linking to ./myBrokenLink (resolved as: /docs/myBrokenLink) | ||
-> linking to ../otherBrokenLink (resolved as: /otherBrokenLink) | ||
- On source page path = /otherSourcePage: | ||
-> linking to /badLink | ||
" | ||
`; | ||
|
||
exports[`brokenLinks getBrokenLinksErrorMessage with potential layout broken links 1`] = ` | ||
"Docusaurus found broken links! | ||
Please check the pages of your site in the list bellow, and make sure you don't reference any path that does not exist. | ||
Note: it's possible to ignore broken links with the 'onBrokenLinks' Docusaurus configuration, and let the build pass. | ||
It looks like some of the broken links we found appear in many pages of your site. | ||
Maybe those broken links appear on all pages through your site layout? | ||
We recommend that you check your theme configuration for such links (particularly, theme navbar and footer). | ||
Frequent broken links are linking to: | ||
- ./myBrokenLinkFrequent1 | ||
- ./myBrokenLinkFrequent2 | ||
Exhaustive list of all broken links found: | ||
- On source page path = /docs/page1: | ||
-> linking to ./myBrokenLinkFrequent1 (resolved as: /docs/myBrokenLinkFrequent1) | ||
-> linking to ./myBrokenLinkFrequent2 (resolved as: /docs/myBrokenLinkFrequent2) | ||
- On source page path = /docs/page2: | ||
-> linking to ./myBrokenLinkFrequent1 (resolved as: /docs/myBrokenLinkFrequent1) | ||
-> linking to ./myBrokenLinkFrequent2 (resolved as: /docs/myBrokenLinkFrequent2) | ||
-> linking to ./myBrokenLinkInfrequent1 (resolved as: /docs/myBrokenLinkInfrequent1) | ||
-> linking to ./myBrokenLinkInfrequent2 (resolved as: /docs/myBrokenLinkInfrequent2) | ||
- On source page path = /docs/page3: | ||
-> linking to ./myBrokenLinkFrequent1 (resolved as: /docs/myBrokenLinkFrequent1) | ||
-> linking to ./myBrokenLinkFrequent2 (resolved as: /docs/myBrokenLinkFrequent2) | ||
- On source page path = /docs/page4: | ||
-> linking to ./myBrokenLinkFrequent1 (resolved as: /docs/myBrokenLinkFrequent1) | ||
-> linking to ./myBrokenLinkFrequent2 (resolved as: /docs/myBrokenLinkFrequent2) | ||
-> linking to ./myBrokenLinkInfrequent1 (resolved as: /docs/myBrokenLinkInfrequent1) | ||
-> linking to ./myBrokenLinkInfrequent2 (resolved as: /docs/myBrokenLinkInfrequent2) | ||
- On source page path = /docs/page5: | ||
-> linking to ./myBrokenLinkFrequent1 (resolved as: /docs/myBrokenLinkFrequent1) | ||
-> linking to ./myBrokenLinkFrequent2 (resolved as: /docs/myBrokenLinkFrequent2) | ||
- On source page path = /docs/page6: | ||
-> linking to ./myBrokenLinkFrequent1 (resolved as: /docs/myBrokenLinkFrequent1) | ||
-> linking to ./myBrokenLinkFrequent2 (resolved as: /docs/myBrokenLinkFrequent2) | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters