2022-02-06 12:51:54 +00:00
|
|
|
{{- $assetBusting := not .Site.Params.disableAssetsBusting }}
|
2023-06-02 00:18:41 +00:00
|
|
|
{{- $faviconMatch := false }}
|
|
|
|
{{- $svg := dict "ext" "svg" "type" "image/svg+xml" }}
|
|
|
|
{{- $png := dict "ext" "png" "type" "image/png" }}
|
|
|
|
{{- $ico := dict "ext" "ico" "type" "image/x-icon" }}
|
|
|
|
{{- $faviconTypes := slice $svg $png $ico }}
|
|
|
|
{{- range $faviconTypes }}
|
|
|
|
{{- if and
|
|
|
|
(eq $faviconMatch false)
|
|
|
|
(or
|
|
|
|
(fileExists (printf "/static/images/favicon-light.%s" .ext))
|
|
|
|
(fileExists (printf "/static/images/favicon-dark.%s"))
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
{{- $faviconMatch = true }}
|
2023-06-01 20:37:33 +00:00
|
|
|
{{/*
|
|
|
|
Warning: IE and old browser versions do not support media queries necessary for the light & dark theme option.
|
|
|
|
If you have requirements to support IE and/or older browser versions, use one of the other options.
|
|
|
|
Reference: https://caniuse.com/css-media-interaction
|
|
|
|
*/}}
|
2023-06-02 00:18:41 +00:00
|
|
|
{{- if (fileExists (printf "/static/images/favicon-light.%s" .ext)) }}
|
|
|
|
<link href="{{ printf "images/favicon-light.%s" .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="{{ .type }}" media="(prefers-color-scheme: light)">
|
2023-06-01 20:37:33 +00:00
|
|
|
{{- end }}
|
2023-06-02 00:18:41 +00:00
|
|
|
{{- if (fileExists (printf "/static/images/favicon-dark.%s" .ext)) }}
|
|
|
|
<link href="{{ printf "images/favicon-dark.%s" .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="{{ .type }}" media="(prefers-color-scheme: dark)">
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- range $faviconTypes }}
|
|
|
|
{{- if and
|
|
|
|
(eq $faviconMatch false)
|
|
|
|
(fileExists (printf "/static/images/favicon.%s" .ext))
|
|
|
|
}}
|
|
|
|
{{- $faviconMatch = true }}
|
|
|
|
<link href="{{ printf "images/favicon.%s" .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="{{ .type }}">
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- range $faviconTypes }}
|
|
|
|
{{- if and
|
|
|
|
(eq $faviconMatch false)
|
|
|
|
(fileExists (printf "/static/images/logo.%s" .ext))
|
|
|
|
}}
|
|
|
|
{{- $faviconMatch := true }}
|
|
|
|
<link href="{{ printf "images/logo.%s" .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" type="{{ .type }}">
|
2023-06-01 20:37:33 +00:00
|
|
|
{{- end }}
|
2022-02-06 12:51:54 +00:00
|
|
|
{{- end }}
|