From 8b2a439df590e10c946cb6458246dc177d07990f Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Fri, 11 Apr 2025 15:19:07 +0200 Subject: [PATCH] Move head partials in to a head sub dir. Create a footer.html partial. --- README.md | 4 +-- layouts/_partials/footer.html | 4 +++ layouts/_partials/head/extra.html | 1 + layouts/_partials/{ => head}/favicons.html | 0 layouts/_partials/{ => head}/math.html | 0 .../{ => head}/meta-breadcrumb-json-ld.html | 0 .../_partials/{ => head}/meta-json-ld.html | 4 +-- layouts/_partials/{ => head}/meta.html | 0 layouts/_partials/{ => head}/scripts.html | 0 layouts/_partials/{ => head}/styles.html | 0 layouts/_partials/{ => head}/tracking.html | 0 layouts/baseof.html | 25 ++++++------------- 12 files changed, 17 insertions(+), 21 deletions(-) create mode 100644 layouts/_partials/footer.html create mode 100644 layouts/_partials/head/extra.html rename layouts/_partials/{ => head}/favicons.html (100%) rename layouts/_partials/{ => head}/math.html (100%) rename layouts/_partials/{ => head}/meta-breadcrumb-json-ld.html (100%) rename layouts/_partials/{ => head}/meta-json-ld.html (92%) rename layouts/_partials/{ => head}/meta.html (100%) rename layouts/_partials/{ => head}/scripts.html (100%) rename layouts/_partials/{ => head}/styles.html (100%) rename layouts/_partials/{ => head}/tracking.html (100%) diff --git a/README.md b/README.md index b1bde64..251ce96 100644 --- a/README.md +++ b/README.md @@ -379,9 +379,9 @@ The theme will autodetect them and add the needed code. ### Head and footer partials -If you create partials named `head.html` and/or `footer.html` they will be used. They do not exist in the theme but are supported as a convenience. +If you create partials named `head/extra.html` and/or `footer.html` they will be used. They do not exist or are empty in the theme but are supported as a convenience. -Content in the "head" partial will be added to the end of the "head" tag, perhaps some extra css or javascript. +Content in the "head/extra" partial will be added to the end of the "head" tag, perhaps some extra css or javascript. Content in the "footer" partial will replace all the default content in the "footer" tag. diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html new file mode 100644 index 0000000..0609fa3 --- /dev/null +++ b/layouts/_partials/footer.html @@ -0,0 +1,4 @@ +{{ if $.Param "feedlinks" }}{{ partial "feedlinks.html" . }}{{ end -}} +

{{ with site.Copyright }}{{ . | site.Home.RenderString }}{{ else }}© {{ site.Title }}{{ end }}

+{{ with $.Param "footer" }}

{{ . | site.Home.RenderString }}

{{ end }} +{{ if $.Param "poweredby" }}

Powered by Hugo and the Zen theme.

{{ end }} diff --git a/layouts/_partials/head/extra.html b/layouts/_partials/head/extra.html new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/layouts/_partials/head/extra.html @@ -0,0 +1 @@ + diff --git a/layouts/_partials/favicons.html b/layouts/_partials/head/favicons.html similarity index 100% rename from layouts/_partials/favicons.html rename to layouts/_partials/head/favicons.html diff --git a/layouts/_partials/math.html b/layouts/_partials/head/math.html similarity index 100% rename from layouts/_partials/math.html rename to layouts/_partials/head/math.html diff --git a/layouts/_partials/meta-breadcrumb-json-ld.html b/layouts/_partials/head/meta-breadcrumb-json-ld.html similarity index 100% rename from layouts/_partials/meta-breadcrumb-json-ld.html rename to layouts/_partials/head/meta-breadcrumb-json-ld.html diff --git a/layouts/_partials/meta-json-ld.html b/layouts/_partials/head/meta-json-ld.html similarity index 92% rename from layouts/_partials/meta-json-ld.html rename to layouts/_partials/head/meta-json-ld.html index a4987fe..862b47a 100644 --- a/layouts/_partials/meta-json-ld.html +++ b/layouts/_partials/head/meta-json-ld.html @@ -6,7 +6,7 @@ {{ if .IsPage -}} "@type": {{ if in $blogSections .Section }}"BlogPosting",{{ else }}"WebPage", {{ if in $breadcrumbSections .Section -}} - "breadcrumb": {{ partial "meta-breadcrumb-json-ld.html" . }}, + "breadcrumb": {{ partial "head/meta-breadcrumb-json-ld.html" . }}, {{ end -}} {{ end -}} "headline": {{ .Title }}, @@ -24,7 +24,7 @@ {{ else -}} "@type": "WebPage", {{ if in $breadcrumbSections .Section -}} - "breadcrumb": {{ partial "meta-breadcrumb-json-ld.html" . }}, + "breadcrumb": {{ partial "head/meta-breadcrumb-json-ld.html" . }}, {{ end -}} "url" : {{ .Permalink }}, "name": {{ .Title }}, diff --git a/layouts/_partials/meta.html b/layouts/_partials/head/meta.html similarity index 100% rename from layouts/_partials/meta.html rename to layouts/_partials/head/meta.html diff --git a/layouts/_partials/scripts.html b/layouts/_partials/head/scripts.html similarity index 100% rename from layouts/_partials/scripts.html rename to layouts/_partials/head/scripts.html diff --git a/layouts/_partials/styles.html b/layouts/_partials/head/styles.html similarity index 100% rename from layouts/_partials/styles.html rename to layouts/_partials/head/styles.html diff --git a/layouts/_partials/tracking.html b/layouts/_partials/head/tracking.html similarity index 100% rename from layouts/_partials/tracking.html rename to layouts/_partials/head/tracking.html diff --git a/layouts/baseof.html b/layouts/baseof.html index 7294327..de18335 100644 --- a/layouts/baseof.html +++ b/layouts/baseof.html @@ -4,16 +4,14 @@ {{ block "title" . }}{{ .Title }} – {{ site.Title }}{{ end }} -{{ partial "meta.html" . }} -{{ partialCached "favicons.html" . }} -{{ partialCached "styles.html" . }} -{{ partial "meta-json-ld.html" . }} -{{ partial "scripts.html" . }} -{{ partial "math.html" . }} -{{ partialCached "tracking.html" . }} -{{ if templates.Exists "partials/head.html" -}} -{{ partial "head.html" . }} -{{ end -}} +{{ partial "head/meta.html" . }} +{{ partialCached "head/favicons.html" . }} +{{ partialCached "head/styles.html" . }} +{{ partial "head/meta-json-ld.html" . }} +{{ partial "head/scripts.html" . }} +{{ partial "head/math.html" . }} +{{ partialCached "head/tracking.html" . }} +{{ partial "head/extra.html" . }} {{ block "head" . }}{{ end }} @@ -42,14 +40,7 @@ {{ if $.Param "sidebar" }}{{ partial "sidebar.html" . }}{{ end -}} {{ if $.Param "cookieconsent" }}{{ partialCached "cookieconsent.html" . }}{{ end -}}