Update template for more recent Hugo

Amolith created

Change summary

themes/secluded/layouts/partials/head.html | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)

Detailed changes

themes/secluded/layouts/partials/head.html 🔗

@@ -38,11 +38,20 @@
     <meta property="og:image" content="{{ if .IsHome }}{{ .Site.Params.cover }}{{ else }}{{ .Params.Cover }}{{ end }}" />
 
     <!-- Styles -->
-    {{ $options := (dict "outputStyle" "compressed" "enableSourceMap" true) }}
-    {{ $scss := resources.Get "scss/imports.scss" }}
-    {{ $style := $scss | resources.ToCSS $options }}
-    <link rel="preload" href="{{ $style.RelPermalink }}?{{ now.Unix }}" as="style">
-    <link rel="stylesheet" href="{{ $style.RelPermalink }}?{{ now.Unix }}">
+    {{ with resources.Get "scss/imports.scss" }}
+    {{ $opts := dict "outputStyle" "compressed" "enabledSourceMap" true "transpiler" "libsass" "targetPath" "css/style.css" }}
+    {{ with . | toCSS $opts }}
+    {{ if hugo.IsDevelopment }}
+    <link rel="preload" href="{{ .RelPermalink }}" as="style">
+    <link rel="stylesheet" href="{{ .RelPermalink }}">
+    {{ else }}
+    {{ with . | minify | fingerprint }}
+    <link rel="preload" href="{{ .RelPermalink }}" as="style">
+    <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
+    {{ end }}
+    {{ end }}
+    {{ end }}
+    {{ end }}
 
     {{ partialCached "favicons.html" . }}