From 914fa28390a92ad917144397c4a3ca310e685dfb Mon Sep 17 00:00:00 2001 From: stradichenko Date: Sun, 26 Apr 2026 15:01:26 +0200 Subject: [PATCH] Unit 7: single / list / home + shared icons partial + print partial - single.html: drop the in-template asset bundler (now lives in head/styles.html). Replace inline metadata SVGs with calls to a new partials/icons.html. i18n Created / Updated / TableOfContents. Add loading=lazy + decoding=async + responsive srcset to the header image. Move inline -{{ end }} - - -{{ if gt (len $styles) 0 }} - {{ $combinedStyles := $styles | resources.Concat "css/single-page.css" | resources.Minify | fingerprint }} - -{{ end }} +{{ partial "print-vars.html" . }} {{ end }} diff --git a/layouts/partials/icons.html b/layouts/partials/icons.html new file mode 100644 index 0000000..5887c0d --- /dev/null +++ b/layouts/partials/icons.html @@ -0,0 +1,67 @@ +{{- /* + layouts/partials/icons.html + + Reusable SVG icon library for PKB-theme. Centralizes inline SVGs that were + previously scattered across single.html, header.html, footer.html, etc. + + Usage: + {{ partial "icons.html" (dict "name" "calendar") }} + {{ partial "icons.html" (dict "name" "calendar" "class" "meta-icon") }} + {{ partial "icons.html" (dict "name" "github" "size" 20) }} + + Args (passed via dict): + name (string, required) - icon identifier (calendar, clock, share, ...) + class (string, optional) - CSS class on the ; defaults to "icon" + size (int, optional) - pixel width/height; defaults vary per icon + + Available icons: + calendar, clock, share, edit, github, twitter, linkedin, instagram, + orcid, email, rss, x-close, search, menu, sun, moon, user, folder, + tag, copy +*/ -}} +{{- $name := .name | default "" -}} +{{- $class := .class | default "icon" -}} +{{- $size := .size | default 16 -}} +{{- if eq $name "calendar" -}} + +{{- else if eq $name "clock" -}} + +{{- else if eq $name "user" -}} + +{{- else if eq $name "folder" -}} + +{{- else if eq $name "tag" -}} + +{{- else if eq $name "share" -}} + +{{- else if eq $name "edit" -}} + +{{- else if eq $name "github" -}} + +{{- else if eq $name "twitter" -}} + +{{- else if eq $name "linkedin" -}} + +{{- else if eq $name "instagram" -}} + +{{- else if eq $name "orcid" -}} + +{{- else if eq $name "email" -}} + +{{- else if eq $name "rss" -}} + +{{- else if eq $name "x-close" -}} + +{{- else if eq $name "search" -}} + +{{- else if eq $name "menu" -}} + +{{- else if eq $name "sun" -}} + +{{- else if eq $name "moon" -}} + +{{- else if eq $name "copy" -}} + +{{- else -}} +{{- warnf "icons.html: unknown icon name %q" $name -}} +{{- end -}} diff --git a/layouts/partials/print-vars.html b/layouts/partials/print-vars.html new file mode 100644 index 0000000..3104c28 --- /dev/null +++ b/layouts/partials/print-vars.html @@ -0,0 +1,23 @@ +{{- /* + layouts/partials/print-vars.html + + Emits an inline