From d0b223fa3353d411d7f05fab8de0a1edda66a695 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Mon, 7 Nov 2022 08:36:39 -0800 Subject: [PATCH] All the template updates for fingerprinting --- layouts/_default/baseof.html | 48 ++++++++++++------------------------ layouts/_default/single.html | 22 +++++++++++------ 2 files changed, 31 insertions(+), 39 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 0116b4b..0f547f8 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -13,40 +13,24 @@ {{ end }} - - - {{- if not hugo.IsProduction -}} - - {{- end -}} - - {{- $includedCSS := slice -}} - {{- if not .FirstSection.IsHome -}} - {{- range .FirstSection.Resources.Match "*.css" -}} - {{- if not (in $includedCSS .Permalink) -}} - {{- $includedCSS = $includedCSS | append .Permalink -}} - - {{- end -}} - {{- end -}} - {{- end -}} - - {{- range .Resources.Match "*.css" -}} - {{- if not (in $includedCSS .Permalink) -}} - {{- $includedCSS = $includedCSS | append .Permalink -}} - - {{- end -}} - {{- end -}} + {{- $rootCSS := resources.Get "styles/root.css" + | resources.ExecuteAsTemplate "root.css" . + | resources.Fingerprint "sha512" -}} + + {{ if not hugo.IsProduction }} + + {{ end }} + {{ with partial "secure_asset.html" (printf "styles/%s.css" .Section) }} + + {{ end }} + {{ range .Resources.Match "*.css" }} + + {{ end }} {{ block "styles" . }}{{ end }} - {{ block "scripts" . }}{{ end }} - + {{ $concatenatedSiteScript := resources.Get "scripts/site.js" + | resources.Fingerprint "sha512" }} + diff --git a/layouts/_default/single.html b/layouts/_default/single.html index dfaae82..fb78001 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,25 +8,33 @@ {{ define "styles" }} {{- if .HasShortcode "figures/railroad" -}} - + {{- end -}} {{ end }} {{ define "scripts" }} {{- if .HasShortcode "figures/railroad" -}} - - + {{- with partial "secure_asset.html" "scripts/lib/railroad.js" -}} + + {{- end -}} + {{- with resources.Get "scripts/railroad-utils.js" -}} + + {{- end -}} {{- end -}} {{- if .HasShortcode "figures/p5" -}} - - + {{- with partial "secure_asset.html" "scripts/lib/p5-1.5.0.js" -}} + + {{- end -}} + {{- with partial "secure_asset.html" "scripts/sketch-utils.js" -}} + + {{- end -}} {{- end -}} {{- range $script := .Resources.Match "*.js" -}} - {{- $isModule := default true $script.Params.is_module -}} - + {{- $isModule := default true $script.Params.is_module -}} + {{- end -}} {{ end }}