You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.5 KiB
HTML
40 lines
1.5 KiB
HTML
{{ $params := . }}
|
|
|
|
{{ $crossorigin := $params.crossorigin | default "anonymous" }}
|
|
{{ $href := $params.href }}
|
|
{{ $includepaths := $params.includepaths }}
|
|
{{ $integrity := $params.integrity }}
|
|
{{ $referrerpolicy := $params.referrerpolicy | default "no-referrer" }}
|
|
{{ $sass := $params.sass }}
|
|
{{ $template := $params.template }}
|
|
|
|
{{ $enablesourcemap := not hugo.IsProduction }}
|
|
{{ $outputstyle := cond hugo.IsProduction "compressed" "" }}
|
|
|
|
{{ if not $href }}
|
|
{{ errorf "layouts/partials/paige/link.html: no href" }}
|
|
{{ end }}
|
|
|
|
{{ with partial "paige/resource.html" $href }}
|
|
{{ $resource := . }}
|
|
|
|
{{ if $template }}
|
|
{{ $context := dict "color" (page.Param "paige.color" | default "#0d6efd") }}
|
|
{{ $split := path.Split $href }}
|
|
{{ $join := path.Join $split.Dir (print (printf "%#v" $context | sha1) "-" $split.File) }}
|
|
{{ $resource = resources.ExecuteAsTemplate $join $context . }}
|
|
{{ end }}
|
|
|
|
{{ if $sass }}
|
|
{{ $resource = $resource | toCSS (dict "enableSourceMap" $enablesourcemap "includePaths" $includepaths "outputStyle" $outputstyle "transpiler" "dartsass") }}
|
|
{{ end }}
|
|
|
|
{{ $resource = $resource | minify | fingerprint }}
|
|
{{ $href = $resource.RelPermalink }}
|
|
{{ $integrity = $resource.Data.Integrity }}
|
|
{{ else }}
|
|
{{ $href = relLangURL $href }}
|
|
{{ end }}
|
|
|
|
<link {{ with $crossorigin }} crossorigin="{{ . }}" {{ end }} href="{{ $href | safeURL }}" {{ with $integrity }} integrity="{{ . }}" {{ end }} {{ with $referrerpolicy }} referrerpolicy="{{ . }}" {{ end }} rel="stylesheet">
|