Add agent tooling and restore the legal footer links

The footer override at layouts/partials/footer.html stopped being applied when
PaperMod moved its partials to layouts/_partials/: the Datenschutz and Impressum
links had silently vanished from the live site, and the copied theme JS was
stale. Drop the 135-line fork and get the links from params.footer.text, which
the theme renders itself.

Agentic setup:
- AGENTS.md: repo map, writing rules, guardrails, definition of done, backlog
- Makefile: dockerised build/serve/check/new/clean, pinned Hugo 0.169.0
- scripts/new-post.sh: creates a correct draft page bundle
- scripts/check-links.py: fails on unresolved internal links
- .editorconfig for consistent whitespace

CI/build:
- pin ghcr.io/gohugoio/hugo to v0.169.0 instead of :latest
- serialise runs per ref so deploys cannot race
- only send the Telegram notification for pushes

Also: trailing slash on the howto menu URL, ignore .hugo_build.lock, document the
dead Universal Analytics ID, and remove two unused duplicate images (304 KB).
This commit is contained in:
morpheus committed 2026-11-06 10:06:13 +01:00
1 parent 94ea700088
commit 9a02ee8111
12 files changed
+320 -139

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
[*.{yml,yaml,json}]
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
+10 -3
View File
@@ -6,6 +6,11 @@ on:
- master
pull_request:
# Serialise deploys per ref so two quick pushes cannot publish out of order.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
@@ -15,11 +20,13 @@ jobs:
with:
submodules: recursive
# The image runs as a non-root user, so the mounted workspace must be
# writable. Keep HUGO_VERSION in sync with the Makefile.
- name: Prepare workspace
run: chmod -R 777 .
run: chmod -R a+rwX .
- name: Build
uses: docker://ghcr.io/gohugoio/hugo:latest
uses: docker://ghcr.io/gohugoio/hugo:v0.169.0
with:
args: --minify
@@ -37,7 +44,7 @@ jobs:
strip_components: 1
- name: Send Telegram notification
if: always()
if: always() && github.event_name == 'push'
uses: appleboy/telegram-action@v0.1.1
with:
to: ${{ secrets.TELEGRAM_TO }}
+1
View File
@@ -395,6 +395,7 @@ FodyWeavers.xsd
# Generated files by hugo
/public/
/resources/_gen/
/.hugo_build.lock
# Executable may be added to repository
hugo.exe
+90
View File
@@ -0,0 +1,90 @@
# AGENTS.md
Instructions for coding agents working on this repository. Keep them in sync
with the tooling; if a command below stops working, fix the command here first.
## What this is
The Hugo source of https://poweronoff.click, a German-language blog about agile
leadership and engineering management by Stan Nowogrudski. Theme: PaperMod
(git submodule). Deployed by Gitea Actions via `scp` on every push to `master`.
## Commands
Hugo is **not** installed on the host. Everything runs through the pinned
official Docker image (`HUGO_VERSION` in the `Makefile`, mirrored in
`.gitea/workflows/build.yml`).
```sh
make build # production build into public/ (minified)
make serve # http://localhost:1313 with drafts, live reload
make check # build + generated-site assertions + internal link check
make new slug=my-post title="Mein Titel" # new draft page bundle
make clean # remove public/ and resources/
make theme-update # bump the PaperMod submodule, then review + `make check`
```
`make check` is the definition of done for any change. It fails on placeholder
text, a leaked `localhost:1313` base URL, or broken internal links.
## Layout
| Path | Meaning |
| --- | --- |
| `config.yml` | All site config: params, menus, social icons, footer text |
| `content/posts/<slug>/index.md` | Page bundle per post; cover image may live next to it |
| `content/*.md` | Standalone pages (about, impressum, data protection) |
| `layouts/shortcodes/obfuscate.html` | Base64 email obfuscation shortcode |
| `static/` | Files served at the site root (images, icons) |
| `themes/PaperMod` | Git submodule. **Never edit it.** Override from `layouts/` instead |
| `.gitea/workflows/build.yml` | Build, deploy, Telegram notification |
Do not recreate `layouts/partials/footer.html`. It used to be a copy of the
theme footer, which silently stopped working when PaperMod moved to
`layouts/_partials/` (the legal links disappeared from the site). The
Datenschutz/Impressum links now come from `params.footer.text` in `config.yml`.
## Writing rules
- Posts are written in **German**; `howto-work-with-stan.md` is the English
exception. Do not translate existing content unless asked.
- Voice: first person, opinionated, practical. Do not add marketing filler.
- New posts start as `draft: true`. `buildDrafts` is off, so drafts never deploy.
- The paragraph before `<!--more-->` becomes the summary; make it meaningful.
- Front matter fields used by the theme: `title`, `date`, `draft`, `tags`,
`categories`, `ShowToc`, `ShowBreadCrumbs`, `cover.{image,alt,caption,relative}`.
- Cover images go in `static/` and are referenced by absolute path
(`/name.jpg`), even with `relative: true`. Use the unsplash/free license
credit in `caption` when the photo is not ours.
- Keep images out of `static/` unless they must be shared; prefer page bundles
with `resources.Get` for new artwork. Flag images larger than ~300 KB.
- Email addresses in content must use the `obfuscate` shortcode:
`{{< obfuscate >}}name@example.com{{< /obfuscate >}}`.
- Do not commit `public/`, `resources/`, `.hugo_build.lock`, or editor droppings.
## Guardrails
- **Never push to `master`** unless the user explicitly asks for a deploy.
A push to `master` builds and overwrites the live site.
- Do not touch `config.yml` secrets/analytics IDs, and never commit credentials.
CI secrets (`SSH_USERNAME`, `SSH_PASSWORD`, `SSH_PORT`, `TELEGRAM_TO`,
`TELEGRAM_TOKEN`) live in Gitea repository settings only.
- Deploy uses password `scp` and `rm: false`, so removed files are **not**
deleted on the server. If you delete a post or image, say so explicitly in
the PR/commit message so it can be cleaned up by hand.
- Theme deprecation warnings are upstream PaperMod noise
(`.Language.LanguageDirection`, `.Language.LanguageCode`). Do not try to fix
them in the submodule; wait for `make theme-update`. There are no other
acceptable Hugo warnings.
## Known issues / backlog
- `googleAnalytics` in `config.yml` is a dead Universal Analytics ID; a GA4
`G-…` property is needed before analytics works again.
- `params.images` (Open Graph / Twitter cards) points at 32–60 px icons. Use a
1200×630 image so shared links render properly.
- Two posts (`a-letter-to-my-younger-self`, `appreciation`) are drafts whose
bodies are still placeholders. They are not published, but do not "clean
them up" without asking — they are the author's unfinished work.
- Deploy would be safer with `rsync --delete` and SSH keys instead of a
password; out of scope unless asked.
+52
View File
@@ -0,0 +1,52 @@
# Local build helpers. The Hugo binary is not installed on the host: every
# target runs the pinned official image so local and CI builds match.
#
# Keep HUGO_VERSION in sync with the image tag in .gitea/workflows/build.yml.
HUGO_VERSION ?= 0.169.0
HUGO_IMAGE ?= ghcr.io/gohugoio/hugo:v$(HUGO_VERSION)
# --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)
.PHONY: help build serve check new clean theme-update
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
@test -f public/index.xml
@! grep -rl "Lorem Ipsum\|dolor sit amet" public --include='*.html' \
|| { 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; }
@python3 scripts/check-links.py public
@echo "ok: site checks passed"
new: ## Create a draft post: make new slug=my-post title="My title"
@test -n "$(slug)" || { echo 'usage: make new slug=my-post [title="My title"]'; exit 2; }
@scripts/new-post.sh "$(slug)" "$(title)"
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."
+12
View File
@@ -3,3 +3,15 @@
Source code for my homepage and my blog poweronoff.click based on [hugo](https://gohugo.io)
[![Build Status](https://code.poweronoff.click/steam/poweronoff.click/actions/workflows/build.yml/badge.svg?branch=master)](https://code.poweronoff.click/steam/poweronoff.click/actions?workflow=build.yml)
## Working on it
Hugo runs in Docker, nothing to install locally:
```sh
make serve # preview on http://localhost:1313
make check # build + link/content checks
make new slug=my-post title="Mein Titel"
```
See [AGENTS.md](AGENTS.md) for the repo map, writing conventions and guardrails.
+8 -1
View File
@@ -10,6 +10,8 @@ buildFuture: false
buildExpired: false
enableEmoji: true
# TODO(analytics): Universal Analytics (UA-*) stopped collecting data on 2023-07-01.
# Create a GA4 property and replace this with its G-XXXXXXXXXX measurement ID (or drop the line).
googleAnalytics: UA-179789773-1
minify:
@@ -74,6 +76,11 @@ params:
- name: twitter
url: "https://twitter.com/djsteamson"
footer:
# Rendered by PaperMod's own footer partial. Keeping this here instead of forking
# layouts/_partials/footer.html means theme updates keep working.
text: "[Datenschutzerklärung](/data_protection/) · [Impressum](/impressum/)"
cover:
hidden: false # hide everywhere but not in structured data
hiddenInList: false # hide on list pages and home
@@ -106,6 +113,6 @@ menu:
weight: 25
- identifier: howto-work-with-me
name: How to work with me
url: /howto-work-with-stan
url: /howto-work-with-stan/
weight: 30
-135
View File
@@ -1,135 +0,0 @@
{{- if not (.Param "hideFooter") }}
<footer class="footer">
{{- if .Site.Copyright }}
<span>{{ .Site.Copyright | markdownify }}</span>
{{- else }}
<span>&copy; {{ now.Year }} <a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></span>
{{- end }}
<span>
Powered by
<a href="https://gohugo.io/" rel="noopener noreferrer" target="_blank">Hugo</a> &
<a href="https://git.io/hugopapermod" rel="noopener" target="_blank">PaperMod</a> &nbsp;&nbsp;
<a href=/data_protection/ rel="noopener" target="_blank">Datenschutzerkl&auml;rung</a> &nbsp;&nbsp;
<a href=/impressum/ rel="noopener" target="_blank">Impressum</a>
</span>
</footer>
{{- end }}
{{- if (not .Site.Params.disableScrollToTop) }}
<a href="#top" aria-label="go to top" title="Go to Top (Alt + G)" class="top-link" id="top-link" accesskey="g">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentColor">
<path d="M12 6H0l6-6z" />
</svg>
</a>
{{- end }}
{{- partial "extend_footer.html" . }}
<script>
let menu = document.getElementById('menu')
menu.scrollLeft = localStorage.getItem("menu-scroll-position");
menu.onscroll = function () {
localStorage.setItem("menu-scroll-position", menu.scrollLeft);
}
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener("click", function (e) {
e.preventDefault();
var id = this.getAttribute("href").substr(1);
if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView({
behavior: "smooth"
});
} else {
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView();
}
if (id === "top") {
history.replaceState(null, null, " ");
} else {
history.pushState(null, null, `#${id}`);
}
});
});
</script>
{{- if (not .Site.Params.disableScrollToTop) }}
<script>
var mybutton = document.getElementById("top-link");
window.onscroll = function () {
if (document.body.scrollTop > 800 || document.documentElement.scrollTop > 800) {
mybutton.style.visibility = "visible";
mybutton.style.opacity = "1";
} else {
mybutton.style.visibility = "hidden";
mybutton.style.opacity = "0";
}
};
</script>
{{- end }}
{{- if (not .Site.Params.disableThemeToggle) }}
<script>
document.getElementById("theme-toggle").addEventListener("click", () => {
if (document.body.className.includes("dark")) {
document.body.classList.remove('dark');
localStorage.setItem("pref-theme", 'light');
} else {
document.body.classList.add('dark');
localStorage.setItem("pref-theme", 'dark');
}
})
</script>
{{- end }}
{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (.Param "ShowCodeCopyButtons")) }}
<script>
document.querySelectorAll('pre > code').forEach((codeblock) => {
const container = codeblock.parentNode.parentNode;
const copybutton = document.createElement('button');
copybutton.classList.add('copy-code');
copybutton.innerText = '{{- i18n "code_copy" | default "copy" }}';
function copyingDone() {
copybutton.innerText = '{{- i18n "code_copied" | default "copied!" }}';
setTimeout(() => {
copybutton.innerText = '{{- i18n "code_copy" | default "copy" }}';
}, 2000);
}
copybutton.addEventListener('click', (cb) => {
if ('clipboard' in navigator) {
navigator.clipboard.writeText(codeblock.textContent);
copyingDone();
return;
}
const range = document.createRange();
range.selectNodeContents(codeblock);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
try {
document.execCommand('copy');
copyingDone();
} catch (e) { };
selection.removeRange(range);
});
if (container.classList.contains("highlight")) {
container.appendChild(copybutton);
} else if (container.parentNode.firstChild == container) {
// td containing LineNos
} else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "TABLE") {
// table containing LineNos and code
codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(copybutton);
} else {
// code blocks not having highlight as parent class
codeblock.parentNode.appendChild(copybutton);
}
});
</script>
{{- end }}
+74
View File
@@ -0,0 +1,74 @@
#!/usr/bin/env python3
"""Fail if the generated site links to local paths that were not built.
Only internal hrefs/srcs that start with "/" are checked and only files under
the given public/ directory are considered. External URLs are ignored.
"""
import html.parser
import os
import sys
import urllib.parse
class LinkParser(html.parser.HTMLParser):
def __init__(self):
super().__init__()
self.links = []
def handle_starttag(self, tag, attrs):
for name, value in attrs:
if name in ("href", "src") and value:
self.links.append(value)
def resolves(root, path):
def exists(p):
return os.path.exists(os.path.join(root, p))
if exists(path):
return True
if exists(os.path.join(path, "index.html")):
return True
if not path.endswith("/") and exists(path + ".html"):
return True
return False
def main():
if len(sys.argv) != 2:
print("usage: check-links.py <public-dir>", file=sys.stderr)
return 2
root = sys.argv[1]
failures = []
for dirpath, _, filenames in os.walk(root):
for filename in filenames:
if not filename.endswith(".html"):
continue
page = os.path.join(dirpath, filename)
rel_page = os.path.relpath(page, root)
with open(page, encoding="utf-8", errors="replace") as handle:
parser = LinkParser()
parser.feed(handle.read())
for link in parser.links:
if not link.startswith("/") or link.startswith("//"):
continue
path = urllib.parse.unquote(urllib.parse.urlsplit(link).path)
if not resolves(root, path.lstrip("/")):
failures.append(f"{rel_page}: {link}")
if failures:
print("broken internal links:", file=sys.stderr)
for failure in sorted(set(failures)):
print(" " + failure, file=sys.stderr)
return 1
print(f"ok: internal links resolve ({len(os.listdir(root))} top-level entries)")
return 0
if __name__ == "__main__":
sys.exit(main())
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
# Create a Hugo page bundle under content/posts/<slug>/index.md as a draft.
# Usage: scripts/new-post.sh <slug> ["Title"]
set -euo pipefail
slug="${1:-}"
title="${2:-}"
if [[ -z "$slug" ]]; then
echo "usage: $(basename "$0") <slug> [\"Title\"]" >&2
exit 2
fi
if [[ ! "$slug" =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
echo "slug must be lowercase kebab-case (letters, digits, single hyphens): $slug" >&2
exit 2
fi
dir="content/posts/$slug"
if [[ -e "$dir" ]]; then
echo "already exists: $dir" >&2
exit 1
fi
if [[ -z "$title" ]]; then
title="$(printf '%s' "$slug" | tr '-' ' ')"
fi
title="${title//\"/\\\"}"
# RFC3339 with a colon in the offset, e.g. 2025-11-06T09:57:00+01:00
now="$(date +%Y-%m-%dT%H:%M:%S%z | sed -E 's/([+-][0-9]{2})([0-9]{2})$/\1:\2/')"
mkdir -p "$dir"
cat > "$dir/index.md" <<EOF
---
title: "$title"
date: $now
draft: true
tags: []
categories: []
ShowToc: false
ShowBreadCrumbs: false
cover:
image: ""
alt: ""
caption: ""
relative: true
---
TODO: intro paragraph. It becomes the summary on list pages and the RSS description.
<!--more-->
TODO: body.
EOF
echo "created $dir/index.md (draft)"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB