From a77c08dbf50822d9b31ccdf21c96989039aeae18 Mon Sep 17 00:00:00 2001 From: Patrick Kollitsch <83281+davidsneighbour@users.noreply.github.com> Date: Mon, 21 Sep 2020 19:02:43 +0700 Subject: [PATCH] Add local extension to header partial I have a use case where I would like to add custom content before the `` tag. This change implements that. Users can add locally (either in their overriding theme or in the root directory) add /layouts/partials/overrides/header.html and the content is printed at that location. I see multiple uses for this, after `
`, before ``... The path in templates.Exists must be run through printf for some reason. --- layouts/partials/head.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index df78ad9..64ae644 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -49,5 +49,11 @@ {{ template "_internal/google_analytics.html" . }} + +{{ if templates.Exists ( printf "partials/overrides/header.html" ) }} + {{ partial "partials/overrides/header.html" . }} +{{ else }} + {{ "" | safeHTML }} +{{ end }} - \ No newline at end of file +