github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/favicon.html (about)

     1      {{- $assetBusting := not .Site.Params.disableAssetsBusting }}
     2      {{- $faviconMatch := false }}
     3      {{- $svg := dict "ext" "svg" "type" "type=\"image/svg+xml\"" }}
     4      {{- $png := dict "ext" "png" "type" "type=\"image/png\"" }}
     5      {{- $ico := dict "ext" "ico" "type" "type=\"image/x-icon\" sizes=\"any\"" }}
     6      {{- $faviconTypes := slice $svg $png $ico }}
     7      {{- $faviconNames := slice "favicon" "logo" }}
     8      {{- range $faviconNames }}
     9        {{- $faviconName := . }}
    10        {{- range $faviconTypes }}
    11          {{- if fileExists (printf "/static/images/%s.%s" $faviconName .ext) }}
    12            {{- $faviconMatch = true }}
    13      <link href="{{ printf "images/%s.%s" $faviconName .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" {{ .type | safeHTMLAttr }}>
    14          {{- end }}
    15          {{- $c:="" }}{{/*
    16            Warning: IE and old browser versions do not support media queries necessary for the light & dark theme option.
    17            If you have requirements to support IE and/or older browser versions, use one of the other options.
    18            Reference: https://caniuse.com/css-media-interaction
    19          */}}
    20          {{- if (fileExists (printf "/static/images/%s-light.%s" $faviconName .ext)) }}
    21            {{- $faviconMatch = true }}
    22      <link href="{{ printf "images/%s-light.%s" $faviconName .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: light)">
    23          {{- end }}
    24          {{- if (fileExists (printf "/static/images/%s-dark.%s" $faviconName .ext)) }}
    25            {{- $faviconMatch = true }}
    26      <link href="{{ printf "images/%s-dark.%s" $faviconName .ext | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="icon" {{ .type | safeHTMLAttr }} media="(prefers-color-scheme: dark)">
    27          {{- end }}
    28        {{- end }}
    29        {{- if $faviconMatch }}
    30          {{- break }}
    31        {{- end }}
    32      {{- end }}