2024-09-11 18:22:53 +00:00
|
|
|
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
|
2023-06-02 00:18:41 +00:00
|
|
|
{{- $faviconMatch := false }}
|
2023-06-05 23:36:37 +00:00
|
|
|
{{- $svg := dict "ext" "svg" "type" "type=\"image/svg+xml\"" }}
|
|
|
|
{{- $png := dict "ext" "png" "type" "type=\"image/png\"" }}
|
|
|
|
{{- $ico := dict "ext" "ico" "type" "type=\"image/x-icon\" sizes=\"any\"" }}
|
2023-06-02 00:18:41 +00:00
|
|
|
{{- $faviconTypes := slice $svg $png $ico }}
|
2023-06-05 23:36:37 +00:00
|
|
|
{{- $faviconNames := slice "favicon" "logo" }}
|
|
|
|
{{- range $faviconNames }}
|
|
|
|
{{- $faviconName := . }}
|
|
|
|
{{- range $faviconTypes }}
|
|
|
|
{{- if fileExists (printf "/static/images/%s.%s" $faviconName .ext) }}
|
|
|
|
{{- $faviconMatch = true }}
|
2024-07-04 06:23:54 +00:00
|
|
|
<link href="{{ printf "images/%s.%s" $faviconName .ext | relURL }}{{ $assetBusting }}" rel="icon" {{ .type | safeHTMLAttr }}>
|
2023-06-05 23:36:37 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if (fileExists (printf "/static/images/%s-light.%s" $faviconName .ext)) }}
|
|
|
|
{{- $faviconMatch = true }}
|
2024-07-04 06:23:54 +00:00
|
|
|
<link href="{{ printf "images/%s-light.%s" $faviconName .ext | relURL }}{{ $assetBusting }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: light)">
|
2023-06-05 22:48:55 +00:00
|
|
|
{{- end }}
|
2023-06-05 23:36:37 +00:00
|
|
|
{{- if (fileExists (printf "/static/images/%s-dark.%s" $faviconName .ext)) }}
|
|
|
|
{{- $faviconMatch = true }}
|
2024-07-04 06:23:54 +00:00
|
|
|
<link href="{{ printf "images/%s-dark.%s" $faviconName .ext | relURL }}{{ $assetBusting }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: dark)">
|
2023-06-05 22:48:55 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2023-06-05 23:36:37 +00:00
|
|
|
{{- if $faviconMatch }}
|
|
|
|
{{- break }}
|
2023-06-05 22:48:55 +00:00
|
|
|
{{- end }}
|
2022-02-06 12:51:54 +00:00
|
|
|
{{- end }}
|