diff --git a/layouts/partials/favicon.html b/layouts/partials/favicon.html index 133066d7e9..0cb896db1a 100644 --- a/layouts/partials/favicon.html +++ b/layouts/partials/favicon.html @@ -5,29 +5,25 @@ {{- $ico := dict "ext" "ico" "type" "type=\"image/x-icon\" sizes=\"any\"" }} {{- $faviconTypes := slice $svg $png $ico }} {{- $faviconNames := slice "favicon" "logo" }} + {{- $normal := dict "suffix" "" "media" "" }} + {{- $light := dict "suffix" "-light" "media" " media=\"(prefers-color-scheme: light\")" }} + {{- $dark := dict "suffix" "-dark" "media" " media=\"(prefers-color-scheme: dark\")" }} + {{- $faviconVariants := slice $normal $light $dark }} {{- range $faviconNames }} {{- $faviconName := . }} {{- range $faviconTypes }} - {{- if or - (resources.Get (printf "/images/%s.%s" $faviconName .ext)) - (fileExists (printf "/static/images/%s.%s" $faviconName .ext)) - }} - {{- $faviconMatch = true }} - - {{- end }} - {{- if or - (resources.Get (printf "/images/%s-light.%s" $faviconName .ext)) - (fileExists (printf "/static/images/%s-light.%s" $faviconName .ext)) - }} - {{- $faviconMatch = true }} - - {{- end }} - {{- if or - (resources.Get (printf "/images/%s-dark.%s" $faviconName .ext)) - (fileExists (printf "/static/images/%s-dark.%s" $faviconName .ext)) - }} - {{- $faviconMatch = true }} - + {{- $faviconType := . }} + {{- range $faviconVariants }} + {{- $faviconVariant := . }} + {{- with (resources.Get (printf "/images/%s%s.%s" $faviconName $faviconVariant.suffix $faviconType.ext)) }} + {{- $faviconMatch = true }} + + {{- else }} + {{- if (fileExists (printf "/static/images/%s%s.%s" $faviconName $faviconVariant.suffix $faviconType.ext)) }} + {{- $faviconMatch = true }} + + {{- end }} + {{- end }} {{- end }} {{- end }} {{- if $faviconMatch }} diff --git a/layouts/partials/version.txt b/layouts/partials/version.txt index 6bf7bf9e82..9df47e9a9c 100644 --- a/layouts/partials/version.txt +++ b/layouts/partials/version.txt @@ -1 +1 @@ -7.3.2+0a3121be8f0b49511eb20df9d2839e10a817fd75 \ No newline at end of file +7.3.2+52e6df6cdf5bc048ceab918c10d6c94a851569ec \ No newline at end of file