Commit 4b612d2
Changed files (5)
blog
content
blog
2026-10-interesting
layouts
_default
_markup
hooks
blog/content/blog/2026-10-interesting/IMG_2867.jpeg
Binary file
blog/content/blog/2026-10-interesting/index.md
@@ -0,0 +1,15 @@
++++
+title = "2026 10 Interesting"
+date = "2026-10-09T15:31:44+11:00"
+
+#
+# description is optional
+#
+# description = "An optional description for SEO. If not provided, an automatically created summary will be used."
+
+tags = []
++++
+
+This is a page about »2026 10 Interesting«.
+
+
blog/layouts/_default/_markup/render-image.html
@@ -0,0 +1,58 @@
+{{- /* Heavily modified from https://runtimeterror.dev/hugo-image-optimization-render-hook/ , which according to the footer there makes this code MIT licensed */ -}}
+{{- /* Also: https://www.brycewray.com/posts/2022/06/responsive-optimized-images-hugo/ */ -}}
+{{- /* theme uses 720px box, so use that as our base, do 0.5x(?), 1x, 1.5x, 2x, 3x. TODO: doesn't handle small images! */ -}}
+{{- $sizes := slice "360" "720" "1080" "1440" "2160" -}}
+{{- $alt := .Text -}}
+{{- $title := "" -}}
+{{- if .Title }}{{ $title = .Title }}{{ else }}{{ $title = .Text }}{{ end -}}
+{{- $src := .Destination -}}
+{{- $webpOpts := "webp q85"}}
+{{- $avifOpts := "avif q75"}}
+{{- $jpegOpts := "jpeg q75"}}
+<picture>
+{{- if .Page.Resources.GetMatch $src -}}
+ {{- with .Page.Resources.GetMatch $src -}}
+ {{- $image := . -}}
+ {{- /* TODO: jxl */ -}}
+ <source type="image/avif" srcset="
+ {{- with $sizes -}}
+ {{- range $i, $e := . -}}
+ {{- if ge $image.Width . -}}
+ {{- $resized := $image.Resize (print . "x " $avifOpts ) -}}
+ {{- if $i }},{{ end }} {{ $resized.RelPermalink }} {{ . }}w
+ {{- end -}}
+ {{- end -}}
+ {{- end -}}" sizes="720px" />
+
+ <source type="image/webp" srcset="
+ {{- with $sizes -}}
+ {{- range $i, $e := . -}}
+ {{- if ge $image.Width . -}}
+ {{- $resized := $image.Resize (print . "x " $webpOpts ) -}}
+ {{- if $i }},{{ end }} {{ $resized.RelPermalink }} {{ . }}w
+ {{- end -}}
+ {{- end -}}
+ {{- end -}}" sizes="720px" />
+
+ <source type="image/jpeg" srcset="
+ {{- with $sizes -}}
+ {{- range $i, $e := . -}}
+ {{- if ge $image.Width . -}}
+ {{- $resized := $image.Resize (print . "x " $jpegOpts ) -}}
+ {{- if $i }},{{ end }} {{ $resized.RelPermalink }} {{ . }}w
+ {{- end -}}
+ {{- end -}}
+ {{- end -}}" sizes="720px" />
+
+
+ {{- $fallback := $image.Resize (print "720x " $jpegOpts ) -}}
+ <img src="{{ $fallback.RelPermalink }}"
+ {{- if $alt -}} alt="{{ $alt }}" {{ end }}
+ {{- if $title -}} title="{{ $title }}" {{ end }}
+ width="{{ $fallback.width }}" height="{{ $fallback.height }}" />
+ {{- end -}}
+{{- else -}}
+ {{- /* present unprocessed/remote images too */ -}}
+ <img src="{{ .Destination | safeURL }}" alt="{{ $alt }}" title="{{ $alt }}" />
+{{- end -}}
+</picture>
blog/.gitignore
@@ -1,2 +1,3 @@
public
.hugo_build.lock
+resources
hooks/pre-commit
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -e -u -o pipefail
+
+# Redirect output to stderr.
+exec 1>&2
+
+if ! which exiftool > /dev/null; then
+ echo "exiftool is required for git pre-commit hook!"
+ exit 1
+fi
+
+# don't commit photo metadata except colour settings
+git diff-index --cached --diff-filter=A --name-only HEAD | grep -Ei '\.(HEIC|jpeg|jpg|tiff|tif|png|webp|avif|jxl)$' | while read file; do
+ exiftool -all= --icc_profile:all -tagsfromfile @ -colorspacetags $file -o $file.tmp > /dev/null
+ if ! diff $file $file.tmp; then
+ echo "Apparently there is metadata still in $file, aborting!"
+ echo "Try:"
+ echo "exiftool -all= --icc_profile:all -tagsfromfile @ -colorspacetags $file"
+ #rm $file.tmp
+ exit 1
+ fi
+ rm $file.tmp
+done