mirror of
https://github.com/tiennm99/blog.git
synced 2026-10-11 12:09:02 +00:00
fix(ci): unbreak smoke + htmltest steps post v0.3.0
Three independent CI failures from run 25916500415: 1. Smoke test [linkToSection aria-label] fail on Hugo 0.146 leg. The assertion pinned to $post selected via `find ... | head -1`, which on 0.146 picked `doc-sach-quan-sat/index.html` — a post with zero h2/h3/h4 headings, so zero heading-anchor markup. Rewrite the check to scan all built post HTML (same pattern already in use for render-link rel). Now reports 13 matches on the demo build. 2. htmltest URLSwap silently never matched. The prior `^/tsuki/: /` config (added in d30f50f) used a regex anchor that doesn't match htmltest's substring evaluation against minified `href=/tsuki/...` attributes. Switch to the unanchored `"/tsuki/": /` form. CI has been failing on this since v0.2.0 despite the "fix" commit; this is the real fix. 3. head.html referenced `/favicon.ico` and `/favicon.svg` but neither asset existed in exampleSite/static/. Add a minimal SVG favicon, drop the legacy .ico reference (modern browsers fall back to a site-rooted /favicon.ico by convention; sites needing one can override head.html). Switch the SVG link to `relURL` so the `/tsuki/` baseURL prefix is honoured under GitHub Pages subpath deploy. Local validation: all 32 smoke checks green; favicon resolves to `/tsuki/favicon.svg` and ships in the build artifact.
This commit is contained in:
1 parent
a3e1da0fe7
commit
f885af9e83
4 files changed
+19
-5
No files matched your search
@@ -5,8 +5,13 @@ IgnoreInternalEmptyHash: true
|
||||
IgnoreEmptyHref: false
|
||||
EnforceHTML5: true
|
||||
# Strip the /tsuki/ baseURL prefix so links resolve against exampleSite/public/.
|
||||
# htmltest's URLSwap is a regex substring match (not anchored), so the leading
|
||||
# "^" used previously silently failed against the minified `href=/tsuki/...`
|
||||
# outputs in built HTML — every link reported missing. Quoted plain-prefix form
|
||||
# matches whatever position /tsuki/ appears in the href, which for our build is
|
||||
# always at the start of relative URLs.
|
||||
URLSwap:
|
||||
^/tsuki/: /
|
||||
"/tsuki/": /
|
||||
IgnoreURLs:
|
||||
- "^https://giscus.app"
|
||||
- "^https://github.com/"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle cx="16" cy="16" r="14" fill="#4a6fa5"/><circle cx="20" cy="14" r="8" fill="#fbfaf7"/></svg>
|
||||
|
After Width: | Height: | Size: 160 B |
@@ -49,9 +49,8 @@
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/* Favicon */}}
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="/favicon.ico" sizes="32x32">
|
||||
{{/* Favicon — SVG only; sites can override head.html to add an .ico fallback */}}
|
||||
<link rel="icon" href="{{ "favicon.svg" | relURL }}" type="image/svg+xml">
|
||||
|
||||
{{/* Speculation Rules — Chromium prefetch hints; gated, off by default */}}
|
||||
{{- $prefetch := site.Params.prefetch -}}
|
||||
|
||||
@@ -70,7 +70,16 @@ assert "BreadcrumbList JSON-LD" '"@type":"BreadcrumbList"' "$p
|
||||
assert "no breadcrumbs on home" 'class=breadcrumbs' "$home" 0
|
||||
assert "prev/next nav" 'class=prev-next' "$post"
|
||||
assert "rel=prev on post" 'rel=prev' "$post"
|
||||
assert "linkToSection aria-label" 'class=heading-anchor [^>]*aria-label' "$post"
|
||||
# Heading-anchor i18n aria-label must appear somewhere in the build. Pinning to one
|
||||
# post is fragile because `$post` is picked by `find | head -1` and short posts
|
||||
# without h2/h3/h4 emit no heading-anchor markup.
|
||||
anchor_count=$({ grep -roE 'class=heading-anchor [^>]*aria-label' "$public_dir" --include='index.html' || true; } | wc -l)
|
||||
if [ "$anchor_count" -lt 1 ]; then
|
||||
echo "::error::FAIL [linkToSection aria-label] expected ≥1 heading-anchor + aria-label across build, got 0"
|
||||
fail=1
|
||||
else
|
||||
echo " ok [linkToSection aria-label] ${anchor_count} match(es) across $public_dir"
|
||||
fi
|
||||
assert "no speculationrules by default" 'speculationrules' "$home" 0
|
||||
|
||||
# llm.txt artifact
|
||||
|
||||
Reference in new issue
Block a user