From a68a2104c64ce4799dfa8f72c62564b59d82edea Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Thu, 12 Oct 2023 09:05:38 +0200 Subject: [PATCH] Support optional head and footer partials. --- README.md | 9 +++++++++ layouts/_default/baseof.html | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a653134..cfc2ae1 100644 --- a/README.md +++ b/README.md @@ -352,6 +352,15 @@ Upload your image to [RealFaviconGenerator](https://realfavicongenerator.net/) t Then set the "realfavicongenerator" param to true to add the needed meta tags. Also good to set the "themeColor" param to correct colour. +### 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. + +Content in the "head" 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. + + ### Layouts To customise a layout included in the zen theme, copy it to the root layout directory and edit it there. Make sure to maintain the directory structure inside the layouts directory. diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index aa27349..9102245 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -6,11 +6,14 @@ {{ block "title" . }}{{ .Title }} – {{ site.Title }}{{ end }} {{ partial "meta.html" . }} {{ partialCached "styles.html" . }} -{{- block "head" . }}{{ end }} {{ partial "meta_json_ld.html" . }} {{ partial "scripts.html" . }} {{ partial "math.html" . }} {{ partialCached "tracking.html" . }} +{{ if templates.Exists "partials/head.html" -}} +{{ partial "head.html" . }} +{{ end -}} +{{ block "head" . }}{{ end }} @@ -38,10 +41,14 @@ {{ if $.Param "sidebar" }}{{ partial "sidebar.html" . }}{{ end -}} {{ if $.Param "cookieconsent" }}{{ partialCached "cookieconsent.html" . }}{{ end -}}