From fbb8548c3cab2b581f28d869843bf87bd805f4b9 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Mon, 12 May 2025 16:36:38 -0400 Subject: README.md: add "HTML Linting" section with htmltest documentation --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/README.md b/README.md index d6a5acd..59378cb 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,44 @@ carousel: The contents of `static/robots.txt` are from [this site][robotstxt-ai] and used to prevent the entire site from being indexed by LLM crawlers. +## HTML Linting + +Install [htmltest][]: + +```bash +# install htmltest +go install https://github.com/wjdp/htmltest@latest +``` + +Run [htmltest][] to look for broken internal links and other common +errors: + +```bash +# run hugo, build site in `./dist` +hugo --minify -d dist + +# run htmltest, ignore links to external sites +htmltest -c .htmltest.yml -s dist +``` + +Results are printed to standard output and saved to +`./tmp/.htmltest/htmltest.log`. + +Run [htmltest][] and check external links: + +```bash +# run hugo, build site in `./dist` +hugo --minify -d dist + +# run htmltest, ignore links to external sites +htmltest -c .htmltest.yml -s dist +``` + +References: + +- [htmltest][] +- [Check links in Hugo with htmltest][htmltest-check-links] + ## Deploy Site To clone site repo: @@ -255,3 +293,7 @@ The [Bulma][] [SASS][] is: "Lossy compression of PNG images." [robotstxt-ai]: https://robotstxt.com/ai "AI / LLM User-Agents: Blocking Guide" +[htmltest]: https://github.com/wjdp/htmltest + "HTML linter which checks for broken links and other errors." +[htmltest-check-links]: https://robb.sh/posts/check-links-in-hugo-with-htmltest/ + "Check links in Hugo with htmltest" -- cgit v1.2.3