From ad0378ae8f6c21487b4a882d6487043082aac0ea Mon Sep 17 00:00:00 2001 From: Troy Lindsay Date: Thu, 1 Jun 2023 16:37:33 -0400 Subject: [PATCH] Add light & dark theme SVG favicon option * #549 --- layouts/partials/favicon.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/layouts/partials/favicon.html b/layouts/partials/favicon.html index 8aec49612d8..0d6bbe3161c 100644 --- a/layouts/partials/favicon.html +++ b/layouts/partials/favicon.html @@ -1,5 +1,17 @@ {{- $assetBusting := not .Site.Params.disableAssetsBusting }} - {{- if (fileExists "/static/images/favicon.svg") }} + {{- if or (fileExists "/static/images/favicon-light.svg") (fileExists "/static/images/favicon-dark.svg") }} + {{/* + 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 + */}} + {{- if (fileExists "/static/images/favicon-light.svg") }} + + {{- end }} + {{- if (fileExists "/static/images/favicon-dark.svg") }} + + {{- end }} + {{- else if (fileExists "/static/images/favicon.svg") }} {{- else if (fileExists "/static/images/favicon.png") }}