Skip to content

Commit 20defc0

Browse files
committed
Explain how to handle external links when checker reports failure
1 parent 608ded3 commit 20defc0

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

.htmltest.yml

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ IgnoreDirs:
2525
IgnoreInternalURLs: # list of paths
2626
IgnoreURLs: # list of regexs of paths or URLs to be ignored
2727
- /index.xml$ # Ignore rel="alternative" links to RSS feeds
28+
- \?no-link-check
2829
- ^/api/?$
2930
- ^((/..)?/docs/languages/\w+|\.\.)/(api|examples|registry)/$
3031
- ^(/..)?/docs/collector/registry/$

content/en/docs/contributing/pr-checks.md

+32-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ a set of checks are executed. The PR checks verify that:
1212

1313
- You have signed the [CLA](#easy-cla)
1414
- Your PR successfully [deploys through Netlify](#netlify-deployment)
15-
- Your changes are compliant with our [style guide](#style-checks)
15+
- Your changes are compliant with our [style guide](#checks)
1616

1717
{{% alert title="Note" color="primary" %}}
1818

@@ -38,7 +38,7 @@ This check fails if you haven't [signed the CLA](../prerequisites/#cla).
3838
If the [Netlify](https://www.netlify.com/) build fails, select **Details** for
3939
more information.
4040

41-
## Style checks
41+
## GitHub PR checks {#checks}
4242

4343
To make sure that contributions follow our [style guide](../style-guide/) we
4444
have implemented a set of checks that verify style guide rules and fail if they
@@ -100,6 +100,36 @@ This check builds the website and verifies that all links are valid.
100100
To check links locally, run `npm run check:links`. This command also updates the
101101
reference cache. Push any changes to the refcache in a new commit.
102102

103+
#### Fix 404s
104+
105+
You need to fix the URLs reported as **invalid** (HTTP status **404**), by
106+
the link checker.
107+
108+
#### Handling valid external links
109+
110+
The link checker will sometimes get an HTTP status other than 200 (success) by
111+
servers that block checkers. Such servers will often return an HTTP status in
112+
the 400 range other than 404, such as 401, 403, or 406, which are the most
113+
common. Some servers, link LinkedIn, report 999.
114+
115+
If you have manually validated an external link that the checker isn't getting a
116+
success status for, you can add the following query parameter to your URL to
117+
have the link checker ignore it: `?no-link-check`. For example,
118+
<https:/some-example.org?no-link-check> will be ignored by the link checker.
119+
120+
{{% alert-md title="Maintainers tip" color=info %}}
121+
122+
Maintainers can run the following script immediately after having run the link
123+
checker to have Puppeteer attempt to validate links with non-success statuses
124+
125+
```sh
126+
./scripts/double-check-refcache-400s.mjs -f --max-num-to-update 99
127+
```
128+
129+
This script also validates URL fragments, which the link checker doesn't do.
130+
131+
{{% /alert-md %}}
132+
103133
### `WARNINGS in build log?` {.notranslate lang=en}
104134

105135
If this check fails, review the `BUILD and CHECK LINKS` log, under the

0 commit comments

Comments
 (0)