From 8ba9239c5c0e82421a0ef2d46c7a8a779b085f87 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Fri, 24 Mar 2023 13:20:06 -0700 Subject: [PATCH] Fix template caching issue with Bootstrap colors --- layouts/partials/paige/link.html | 9 ++++++++- layouts/partials/paige/links.html | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/layouts/partials/paige/link.html b/layouts/partials/paige/link.html index 8a2cd551..6e7eb096 100644 --- a/layouts/partials/paige/link.html +++ b/layouts/partials/paige/link.html @@ -7,6 +7,7 @@ {{ $page := $params.page }} {{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }} {{ $sass := $params.sass }} +{{ $template := $params.template }} {{ $enablesourcemap := not hugo.IsProduction }} {{ $outputstyle := cond hugo.IsProduction "compressed" "" }} @@ -16,7 +17,13 @@ {{ end }} {{ with partial "paige/resource.html" (dict "page" $page "url" $href) }} - {{ $resource := resources.ExecuteAsTemplate $href (or $page dict) . }} + {{ $resource := . }} + + {{ if $template }} + {{ $split := path.Split $href }} + {{ $join := path.Join $split.Dir (print (sha1 $page) "-" $split.File) }} + {{ $resource = resources.ExecuteAsTemplate $join (or $page dict) . }} + {{ end }} {{ if $sass }} {{ $resource = $resource | toCSS (dict "enableSourceMap" $enablesourcemap "includePaths" $includepaths "outputStyle" $outputstyle "transpiler" "dartsass") }} diff --git a/layouts/partials/paige/links.html b/layouts/partials/paige/links.html index 75a3f120..615a11b4 100644 --- a/layouts/partials/paige/links.html +++ b/layouts/partials/paige/links.html @@ -32,7 +32,7 @@ {{ end }} -{{ partial "paige/link.html" (dict "href" "_paige/bootstrap/paige.scss" "page" $page "sass" true) }} +{{ partial "paige/link.html" (dict "href" "_paige/bootstrap/paige.scss" "page" $page "sass" true "template" true) }} {{ partial "paige/link.html" (dict "href" "_paige/bootstrap-icons/bootstrap-icons.css") }} {{ if $page.Param "paige.math" }}