mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 23:38:56 +00:00
e68bdb374b
* Dart Sass calc compatibility * Fix: Default to Dart Sass transpiler + silence deprecations * Fix: Add imagePreview config toggle — wrap the featured image block * Implement featured image preview in summary.html Added featured image preview functionality to summary layout. * Add imagePreview parameter to home posts configuration Added option to control featured image preview in home posts. * Enable image preview in home page post list
48 lines
1.7 KiB
HTML
48 lines
1.7 KiB
HTML
{{- if strings.HasPrefix .Source "<link" -}}
|
|
{{- safeHTML .Source -}}
|
|
{{- else -}}
|
|
{{- $href := .Source -}}
|
|
{{- $integrity := .Integrity -}}
|
|
{{- $resource := 0 -}}
|
|
{{- if $href | and (not (urls.Parse $href).Host) -}}
|
|
{{- $resource = resources.Get $href -}}
|
|
{{- end -}}
|
|
{{- with .Content -}}
|
|
{{- $resource = resources.FromString $.Path . -}}
|
|
{{- end -}}
|
|
{{- if $resource -}}
|
|
{{- with .Template -}}
|
|
{{- $resource = $resource | resources.ExecuteAsTemplate . $.Context -}}
|
|
{{- end -}}
|
|
{{- with .ToCSS -}}
|
|
{{- $options := . | merge (dict "outputStyle" "compressed" "transpiler" "dartsass" "silenceDeprecations" (slice "import" "global-builtin" "color-functions" "function-units")) -}}
|
|
{{- $resource = $resource | toCSS $options -}}
|
|
{{- end -}}
|
|
{{- if .Minify -}}
|
|
{{- $resource = $resource | minify -}}
|
|
{{- end -}}
|
|
{{- with .Fingerprint -}}
|
|
{{- $resource = $resource | fingerprint . -}}
|
|
{{- $integrity = $resource.Data.Integrity -}}
|
|
{{- end -}}
|
|
{{- $href = $resource.RelPermalink -}}
|
|
{{- end -}}
|
|
{{- $attrs := printf `href="%v"` $href -}}
|
|
{{- if .Crossorigin -}}
|
|
{{- $attrs = ` crossorigin="anonymous"` | add $attrs -}}
|
|
{{- end -}}
|
|
{{- with $integrity -}}
|
|
{{- $attrs = printf ` integrity="%v"` . | add $attrs -}}
|
|
{{- end -}}
|
|
{{- with .Attr -}}
|
|
{{- $attrs = add " " . | add $attrs -}}
|
|
{{- end -}}
|
|
{{- if .Preload -}}
|
|
<link rel="preload" {{ $attrs | safeHTMLAttr }} as="style" onload="this.removeAttribute('onload');this.rel='stylesheet'">
|
|
<noscript><link rel="stylesheet" {{ $attrs | safeHTMLAttr }}></noscript>
|
|
{{- else -}}
|
|
<link rel="stylesheet" {{ $attrs | safeHTMLAttr }}>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|