Skip to content

Commit 18d4c20

Browse files
committed
update
1 parent 9829e66 commit 18d4c20

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

src/scripts/link-check/linkcheck.ts

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -230,29 +230,24 @@ function checkChunkFile(linksFile: string, mode: "internal" | "external"): Promi
230230
const canonicalUrls = extractCanonicalUrlsWithLanguageVariants()
231231

232232
// Filter out acceptable warnings:
233-
// 1. Mime type warnings (files without mime type metadata)
234-
// 2. Missing anchor warnings on canonical URLs with language variants
235-
// (these pages redirect based on user's language preference)
233+
// 1. Mime type warnings (files without mime type metadata, e.g. .sol files)
234+
// 2. Missing anchor warnings (anchors may be dynamically generated or client-side only)
235+
// 3. Canonical URL warnings (these pages redirect based on user's language preference)
236236
const blockingWarnings = warningLines.filter((line) => {
237-
// Allow mime type warnings
238-
if (line.toLowerCase().includes("no mime type")) {
237+
const lineLower = line.toLowerCase()
238+
239+
// Allow mime type warnings (e.g., ".sol" files have no standard MIME type)
240+
if (lineLower.includes("mime type")) {
239241
return false
240242
}
241243

242-
// Allow "missing anchor" warnings on canonical URLs with language variants
243-
if (line.includes("missing anchor")) {
244-
// Extract the URL from the warning line
245-
// Format: "... => http://localhost:4321/path#anchor (HTTP 200 but missing anchor)"
246-
const urlMatch = line.match(/http:\/\/localhost:4321([^\s(]+)/)
247-
if (urlMatch) {
248-
// Extract pathname, remove anchor and trailing slash
249-
let path = urlMatch[1].split("#")[0] // Remove anchor
250-
path = path.replace(/\/$/, "") // Remove trailing slash
251-
252-
if (canonicalUrls.has(path)) {
253-
return false // Allow this warning (it's an expected redirect page)
254-
}
255-
}
244+
// Allow all "missing anchor" warnings
245+
// Anchors might be:
246+
// - Dynamically generated by JavaScript
247+
// - Client-side only (not in static HTML)
248+
// - Part of interactive components
249+
if (lineLower.includes("missing anchor")) {
250+
return false
256251
}
257252

258253
return true // This is a blocking warning

0 commit comments

Comments
 (0)