ci(lighthouse): 自動探索編譯後頁面並聚焦無障礙把關#77
Open
ross-nics wants to merge 4 commits into
Open
Conversation
accessibility-statement and contact are single pages output as *.html (uglyURLs=true), so the trailing-slash URLs returned 404 in Lighthouse CI
There was a problem hiding this comment.
Code Review
This pull request updates the Lighthouse configuration in .lighthouserc.json by appending .html extensions to the URLs for the accessibility statement and contact pages. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
- upgrade @lhci/cli to 0.15.x and add workflow_dispatch checkout fallback\n- set staticDirFileDiscoveryDepth to 4 and simplify non-a11y assertions to category warnings\n- avoid redundant alt text on home feature icons for Lighthouse a11y
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
改善 Lighthouse CI 設定,讓它自動探索 Hugo 編譯後的所有頁面,不再維護手動 URL 清單,並將 CI 的硬性把關聚焦在「無障礙(accessibility)」。效能與最佳實務項目改為警示(warn),不阻擋 CI。
變更內容
1. 改用自動探索(staticDistDir)
startServerCommand: "hugo server"與手動維護的 24 筆url清單。staticDistDir: "./public",由 LHCI 啟動內建靜態伺服器並自動掃描public/下所有 HTML。maxAutodiscoverUrls: 0解除預設「只掃 5 頁」的限制,改為掃描全部頁面。2. 排除非正式頁面(autodiscoverUrlBlocklist)
排除 7 個不適合嚴格無障礙稽核的頁面:
categories/、tags/landmark/blank、landmark/one-column、skip-to/skip-to、skip-to/skip-to-multiple、digital-info/digital-info(這些頁面標有
noindex,屬被嵌入的範例片段,非導覽頁。)3. 斷言聚焦無障礙
categories:accessibility維持["error", { minScore: 1 }]—— 唯一的硬性把關。unused-javascript、unsized-images、errors-in-console、crawlable-anchors、inspector-issues、uses-optimized-images、uses-responsive-images、unminified-javascript等)改為warn,在報告中提示但不阻擋 CI。4. 先前修正(沿用)
.html結尾,對齊uglyURLs=true的輸出格式。驗證
hugo --minify產出 44 個受測頁面(已排除 7 個非正式頁)。lhci autorun:44/44 頁 accessibility 全數 1.00 滿分。lhci assert結果:exit 0,僅餘 warning,無 error。注意事項
accessibility minScore: 1現在套用於所有自動探索頁面;未來新增頁面若無障礙不達標會擋下 CI(這是預期的把關行為)。