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:
1 parent
94ea700088
commit
9a02ee8111
12 files changed
+320
-139
No files matched your search
Executable
+74
@@ -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())
|
||||
Executable
+55
@@ -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)"
|
||||
Reference in new issue
Block a user