From 76a18c25417a1ceacd0b00daa3a35c835d460534 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Mon, 27 Nov 2023 19:36:36 -0800 Subject: [PATCH] Include more generator information. - Add generator info to Atom feed. - Add generator version and commit hash to meta page, along with a link to the last CI job if available. - Use $JOB_URL to detect CI since that variable can be re-used to fetch the URL to the latest CI logs. --- config.toml | 4 ++++ content/meta/_index.md | 2 ++ layouts/_default/list.atom.xml | 1 + layouts/shortcodes/build-info.html | 12 ++++++++++++ scripts/get-webmentions.sh | 2 +- 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 layouts/shortcodes/build-info.html diff --git a/config.toml b/config.toml index e5a6544..7b894cc 100644 --- a/config.toml +++ b/config.toml @@ -124,6 +124,10 @@ disableKinds = ["taxonomy", "term"] about = ["HTML", "atom", "RSS"] meta = ["HTML", "atom", "RSS"] +[security] + [security.funcs] + getenv = ['^JOB_URL$'] + # https://github.com/nekr0z/static-webmentions [webmentions] newDir = "public" diff --git a/content/meta/_index.md b/content/meta/_index.md index 146a10a..13a934c 100644 --- a/content/meta/_index.md +++ b/content/meta/_index.md @@ -5,6 +5,8 @@ outputs: - html description: "About this site. How it's built, why it's built that way, privacy, accessibility, mirrors, etc." --- +{{}} + How I run this site ------------------- diff --git a/layouts/_default/list.atom.xml b/layouts/_default/list.atom.xml index 5642581..5e96b25 100644 --- a/layouts/_default/list.atom.xml +++ b/layouts/_default/list.atom.xml @@ -52,6 +52,7 @@ {{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }} + Hugo {{ .Site.Hugo.Version }} {{ .Permalink }} {{ range $pages -}} {{- if not .Params.Private -}} diff --git a/layouts/shortcodes/build-info.html b/layouts/shortcodes/build-info.html new file mode 100644 index 0000000..f738155 --- /dev/null +++ b/layouts/shortcodes/build-info.html @@ -0,0 +1,12 @@ +{{- $now := now -}} +{{- $buildCtx := "on my workstation" -}} +{{- with getenv "JOB_URL" -}} + {{- $buildCtx = `on builds.sr.ht` | safeHTML -}} +{{- end -}} +

+ This site was last built on + + by + Hugo {{ .Site.Hugo.Version }} + {{ $buildCtx }}. +

diff --git a/scripts/get-webmentions.sh b/scripts/get-webmentions.sh index 837770e..44989f6 100644 --- a/scripts/get-webmentions.sh +++ b/scripts/get-webmentions.sh @@ -49,7 +49,7 @@ trap check_cached_webmentions EXIT # Grab my long-lived key (password). We will use this to authenticate. key() { set +u - if [ -n "$BUILD_SUBMITTER" ]; then + if [ -n "$JOB_URL" ]; then cat ~/.webmentiond-key else pash show webmentiond-ci-key