A small toolkit for regenerating sitemap.xml for your GitHub Pages portfolio. This repo provides three interchangeable methods—pick the one that fits your workflow best:
- Local Bash script (
gen-sitemap.sh) - Local Node.js script (
generate-sitemap.js) - GitHub Actions workflow (
.github/workflows/generate-sitemap.yml)
Prerequisites
bash(Linux/macOS)curljq(JSON processor)
Setup & Usage
- Copy
gen-sitemap.shinto your repo root. - Make it executable:
chmod +x gen-sitemap.sh
- Run to build/overwrite
sitemap.xml:./gen-sitemap.sh
- Commit & push the updated sitemap:
git add sitemap.xml git commit -m "chore: update sitemap" git push
Prerequisites
- Node.js v12+
Setup & Usage
- Copy
generate-sitemap.jsinto your repo root. - Install no dependencies—Node’s built-in
httpsmodule is all you need. - Run to regenerate
sitemap.xml:node generate-sitemap.js
- Commit & push:
git add sitemap.xml git commit -m "chore: update sitemap" git push
Prerequisites
- Your repo published via GitHub Pages
- (Optional) a
robots.txtin your root
Setup
- Copy
.github/workflows/generate-sitemap.ymlinto your repo. - Ensure your default branch is
main(or adjust the workflow). - Commit & push the workflow file.
Triggering
- On every push to
main, or - Manually via Actions → Generate sitemap → Run workflow
The job will:
- Checkout your code
- Install
jq - Query GitHub API for all Pages-enabled repos
- Build a fresh
sitemap.xml - Commit & push the result back to
main
GPL v3 © bocaletto-luca