Skip to content

Commit d619b83

Browse files
authored
[CI] Fix link checking for all builds (#5551)
1 parent 9dfa389 commit d619b83

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

.htmltest.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ CheckMailto: false
88
TestFilesConcurrently: true
99
IgnoreDirs:
1010
# DO NOT EDIT! IgnoreDirs list is auto-generated from markdown file front matter.
11-
# 2024-11-03 The following entry is for `en` pages only. Other locales do
12-
# not currently require it.
13-
- ^blog/(\d+/)?page/\d+
11+
# Ignore blog index pages for all locales and in all blog sections (top-level and years)
12+
- ^(../)?blog/(\d+/)?page/\d+
1413
# TODO drop next line after https://github.com/open-telemetry/opentelemetry.io/issues/5423 is fixed for ja pages:
1514
- ^ja/docs/concepts/instrumentation/libraries/
1615
# TODO drop next line after https://github.com/open-telemetry/opentelemetry.io/issues/5423 is fixed for pt pages:
1716
- ^pt/docs/concepts/instrumentation/libraries/
1817
# DO NOT EDIT! IgnoreDirs list is auto-generated from markdown file front matter.
1918
IgnoreInternalURLs: # list of paths
2019
IgnoreURLs: # list of regexs of paths or URLs to be ignored
20+
- /index.xml$ # Ignore rel="alternative" links to RSS feeds
2121
- ^/api$
2222
- ^((/..)?/docs/languages/\w+|\.\.)/(api|examples|registry)/$
2323
- ^(/..)?/docs/collector/registry/$

content/en/blog/_index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ redirects:
88
- { from: 'index.xml', to: '2024/index.xml 301!' }
99
outputs: [HTML, RSS]
1010
htmltest:
11+
# 2024-11-07 DO NOT COPY the following IgnoreDirs to non-en pages because handles all locales.
1112
IgnoreDirs:
12-
# 2024-11-03 The following entry is for `en` pages only. Other locales do
13-
# not currently require it.
14-
- ^blog/(\d+/)?page/\d+
13+
# Ignore blog index pages for all locales and in all blog sections (top-level and years)
14+
- ^(../)?blog/(\d+/)?page/\d+
1515
---

layouts/partials/hooks/head-end.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
{{ end -}}
2323
{{ end -}}
2424
{{ end -}}
25-
<link rel="canonical" href="{{ $canonicalURL }}">
25+
<link rel="canonical" href="{{ $canonicalURL }}" data-proofer-ignore>
2626

2727
{{- end -}}

package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,14 @@
7777
"log:check:links": "npm run check:links | tee tmp/build-log.txt",
7878
"make:public": "make public ls-public",
7979
"netlify-build:preview": "npm run seq -- build:preview diff:check",
80-
"netlify-build:production": "npm run build:production",
80+
"netlify-build:production": "npm run seq -- build:production diff:check",
8181
"postget:submodule": "git submodule",
82-
"postnetlify-build:production": "git restore .htmltest.yml && npm run diff:check",
8382
"prebuild:preview": "npm run _prebuild",
8483
"prebuild:production": "npm run _prebuild",
8584
"prebuild": "npm run _prebuild",
8685
"precheck:links:internal": "npm run build && npm run update:htmltest-config",
8786
"precheck:links": "npm run build && npm run update:htmltest-config",
8887
"prefix:submodules": "npm run update:submodule",
89-
"prenetlify-build:production": "echo 'IgnoreTagAttribute: rel' >> .htmltest.yml",
9088
"prepare": "npm run seq -- get:submodule _prepare:docsy",
9189
"preserve:hugo": "npm run _prebuild",
9290
"preserve:netlify": "npm run seq -- _prebuild _install:netlify-cli",

scripts/htmltest-config.pl

+5-4
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ sub extract_htmltest_config {
4242
return;
4343
}
4444

45-
shift @htmltest_config;
45+
do {
46+
shift @htmltest_config;
47+
} until !@htmltest_config # No more config
48+
|| $htmltest_config[0] !~ /^\s*#/; # Non-comment line
4649

47-
if (@htmltest_config >= 1 && $htmltest_config[0] =~ /^IgnoreDirs:/i) {
48-
return _extract_ignore_dirs($file_path, @htmltest_config)
49-
}
50+
return _extract_ignore_dirs($file_path, @htmltest_config) if $htmltest_config[0] =~ /^IgnoreDirs:/i;
5051

5152
# TODO: Add support for `IgnoreURLs`.
5253

0 commit comments

Comments
 (0)