2026-11-06 10:06:13 +01:00
|
|
|
# Local build helpers. The Hugo binary is not installed on the host: every
|
2026-11-06 10:29:33 +01:00
|
|
|
# target runs the official Docker image, same tag as CI (`latest`).
|
2026-11-06 10:06:13 +01:00
|
|
|
#
|
2026-11-06 10:29:33 +01:00
|
|
|
# `latest` moves without warning. To reproduce a build from an older point in
|
|
|
|
|
# time, override the image explicitly, e.g.:
|
|
|
|
|
# make check HUGO_IMAGE=ghcr.io/gohugoio/hugo:v0.169.0
|
2026-11-06 10:06:13 +01:00
|
|
|
|
2026-11-06 10:29:33 +01:00
|
|
|
HUGO_IMAGE ?= ghcr.io/gohugoio/hugo:latest
|
2026-11-06 10:06:13 +01:00
|
|
|
# --user keeps public/ owned by you instead of root (CI works around this with chmod).
|
|
|
|
|
DOCKER_RUN = docker run --rm \
|
|
|
|
|
-u "$(shell id -u):$(shell id -g)" \
|
|
|
|
|
-e HOME=/tmp \
|
|
|
|
|
-e HUGO_CACHEDIR=/tmp/hugo-cache \
|
|
|
|
|
-v "$(CURDIR)":/src \
|
|
|
|
|
-w /src
|
|
|
|
|
HUGO = $(DOCKER_RUN) $(HUGO_IMAGE)
|
|
|
|
|
|
2026-11-06 10:40:48 +01:00
|
|
|
.PHONY: help build serve check new-project clean theme-update
|
2026-11-06 10:06:13 +01:00
|
|
|
|
|
|
|
|
help: ## Show this help
|
|
|
|
|
@grep -hE '^[a-z-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-14s %s\n", $$1, $$2}'
|
|
|
|
|
|
|
|
|
|
build: ## Build the production site into public/
|
|
|
|
|
@$(HUGO) --minify --gc --cleanDestinationDir
|
|
|
|
|
@echo "ok: public/"
|
|
|
|
|
|
|
|
|
|
serve: ## Preview on http://localhost:1313 (drafts included)
|
|
|
|
|
@$(DOCKER_RUN) -p 1313:1313 $(HUGO_IMAGE) server --bind 0.0.0.0 --port 1313 --buildDrafts --navigateToChanged
|
|
|
|
|
|
|
|
|
|
check: build ## Build, then verify the generated site
|
|
|
|
|
@test -f public/index.html
|
|
|
|
|
@test -f public/sitemap.xml
|
|
|
|
|
@test -f public/robots.txt
|
2026-11-06 10:43:32 +01:00
|
|
|
@test -f public/about/index.html
|
2026-11-06 10:40:48 +01:00
|
|
|
@test -f public/impressum/index.html
|
|
|
|
|
@test -f public/data_protection/index.html
|
|
|
|
|
@grep -q 'project-card' public/index.html \
|
|
|
|
|
|| { echo "FAIL: no project cards rendered (data/projects.yaml?)"; exit 1; }
|
|
|
|
|
@grep -q 'berlin-crime.poweronoff.click' public/index.html \
|
|
|
|
|
|| { echo "FAIL: Berlin Crime Stories missing from the landing page"; exit 1; }
|
2026-11-06 10:06:13 +01:00
|
|
|
@! grep -rl "Lorem Ipsum\|dolor sit amet\|TODO: body\.\|TODO: intro paragraph" public --include='*.html' \
|
2026-11-06 10:06:13 +01:00
|
|
|
|| { echo "FAIL: placeholder text found in public/"; exit 1; }
|
|
|
|
|
@! grep -rl "localhost:1313" public --include='*.html' \
|
|
|
|
|
|| { echo "FAIL: dev baseURL leaked into public/"; exit 1; }
|
2026-11-06 10:46:34 +01:00
|
|
|
@! grep -rl "github.com/poweronoff" public --include='*.html' \
|
|
|
|
|
|| { echo "FAIL: the author's GitHub profile must not be linked"; exit 1; }
|
2026-11-06 10:06:13 +01:00
|
|
|
@python3 scripts/check-links.py public
|
|
|
|
|
@echo "ok: site checks passed"
|
|
|
|
|
|
2026-11-06 10:40:48 +01:00
|
|
|
new-project: ## Show how to add a project
|
|
|
|
|
@echo 'Add an entry to data/projects.yaml (see the comment at the top), then run make check.'
|
2026-11-06 10:06:13 +01:00
|
|
|
|
|
|
|
|
clean: ## Remove build output and generated assets
|
|
|
|
|
@rm -rf public resources
|
|
|
|
|
@rm -f .hugo_build.lock
|
|
|
|
|
|
|
|
|
|
theme-update: ## Move the PaperMod submodule to its latest master commit
|
|
|
|
|
@git submodule update --remote themes/PaperMod
|
|
|
|
|
@git diff --submodule=log themes/PaperMod
|
|
|
|
|
@echo "Review the theme changelog, run 'make check', then commit the gitlink."
|