The library
Scripts
Small, copy-pasteable snippets I reach for.
Find broken external links Build a Hugo site and list every external link that doesn’t return 200.
hugo --gc --minify -d /tmp/site-check
grep -rhoE 'href="?https?://[^" >]+' /tmp/site-check | sed -E 's/href="?//' | sort -u \
| while read -r u; do
code=$(curl -s -o /dev/null -L -w '%{http_code}' --max-time 10 "$u")
[ "$code" = 200 ] || echo "$code $u"
done
LinkedIn answers bots with 999, so those links usually aren’t really broken.
Start a new story Create a draft post and preview it with drafts turned on.
hugo new content story/my-new-story.md
hugo server -D
Set draft = false in the front matter when it’s ready.
Watch a GitHub Pages deploy Poll the latest Actions run for a public repo until it finishes. No auth needed.
repo="EvanMcDowell31/evanmcdowell31.github.io"
until [ "$(curl -s "https://api.github.com/repos/$repo/actions/runs?per_page=1" \
| python3 -c 'import json,sys;print(json.load(sys.stdin)["workflow_runs"][0]["status"])')" = completed ]; do
sleep 15
done
curl -s "https://api.github.com/repos/$repo/actions/runs?per_page=1" \
| python3 -c 'import json,sys;r=json.load(sys.stdin)["workflow_runs"][0];print(r["conclusion"], r["html_url"])'
Prints success or failure with a link to the run.