From 99c70fd7514ce79d25286f002346a1cdec6a98af Mon Sep 17 00:00:00 2001 From: Simon Spannagel Date: Thu, 27 Apr 2023 23:11:41 +0200 Subject: [PATCH] Add Dark Logo Variant Option --- .../content/docs/configuration/index.md | 2 +- layouts/partials/logo.html | 37 ++++++------------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index 1a4227a5..72491ebb 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -132,7 +132,7 @@ Many of the article defaults here can be overridden on a per article basis by sp |`robots`|_Not set_|String that indicates how robots should handle your site. If set, it will be output in the page head. Refer to [Google's docs](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives) for valid values.| |`header.layout`|`"basic"`|The layout of the page header and menu. Valid values are `basic`, `hamburger`, `hybrid` or `custom`. When set to `custom`, you must provide your own layout by creating a `/layouts/partials/header/custom.html` file.| |`header.logo`|_Not set_|The relative path to the site logo file within the `assets/` folder. The logo file should be provided at 2x resolution and supports any image dimensions.| -|`header.darkLogo`|_Not set_|As per the `header.logo` parameter, however this image is used whenever dark mode is active.| +|`header.logoDark`|_Not set_|The relative path to the dark variant of the site logo file within the `assets/` folder. This variant is only used if the logo is set. The same recommendations as for the logo file apply. | |`header.showTitle`|`true`|Whether the site title is displayed in the header.| |`footer.showCopyright`|`true`|Whether or not to show the copyright string in the site footer. Note that the string itself can be customised using the `copyright` parameter in the [languages configuration](#language-and-i18n).| |`footer.showThemeAttribution`|`true`|Whether or not to show the "powered by" theme attribution in the site footer. If you choose to disable this message, please consider attributing the theme somewhere else on your site (for example, on your about page).| diff --git a/layouts/partials/logo.html b/layouts/partials/logo.html index de66af69..5d7d3de6 100644 --- a/layouts/partials/logo.html +++ b/layouts/partials/logo.html @@ -1,37 +1,24 @@ {{- if .Site.Params.header.logo }} {{- $logo := resources.Get .Site.Params.header.logo }} - {{- $darkLogo := resources.Get .Site.Params.header.darkLogo }} - - - {{- if and $logo $darkLogo }} - - {{ .Site.Title }} - - - - {{- else if $logo }} + {{- $logo_dark := resources.Get .Site.Params.header.logoDark }} + {{- if $logo }} {{ .Site.Title }} + {{- if $logo_dark }} + {{ .Site.Title }} + {{- end}} {{- end }} {{- end }}