🔀 Merge pull request #543 from simonspa/dev

Add Dark Logo Variant Option
pull/567/head
James Panther 2023-05-25 12:38:05 +10:00 committed by GitHub
commit a8847f467e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 26 deletions

View File

@ -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.| |`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.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.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.| |`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.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).| |`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).|

View File

@ -1,37 +1,24 @@
{{- if .Site.Params.header.logo }} {{- if .Site.Params.header.logo }}
{{- $logo := resources.Get .Site.Params.header.logo }} {{- $logo := resources.Get .Site.Params.header.logo }}
{{- $darkLogo := resources.Get .Site.Params.header.darkLogo }} {{- $logo_dark := resources.Get .Site.Params.header.logoDark }}
{{- if $logo }}
<!-- If both logos are present, show different logo accordingly -->
{{- if and $logo $darkLogo }}
<a href="{{ "" | relLangURL }}" class="inline mr-2 dark:hidden">
<img
src="{{ $logo.RelPermalink }}"
width="{{ div $logo.Width 2 }}"
height="{{ div $logo.Height 2 }}"
class="max-h-[10rem] max-w-[10rem] object-scale-down object-left"
alt="{{ .Site.Title }}"
/>
</a>
<a href="{{ "" | relLangURL }}" class="hidden mr-2 dark:inline">
<img
src="{{ $darkLogo.RelPermalink }}"
width="{{ div $darkLogo.Width 2 }}"
height="{{ div $darkLogo.Height 2 }}"
class="max-h-[10rem] max-w-[10rem] object-scale-down object-left"
alt="{{ .Site.Title }}"
/>
</a>
<!-- Else if the standard logo is present, show the logo -->
{{- else if $logo }}
<a href="{{ "" | relLangURL }}" class="mr-2"> <a href="{{ "" | relLangURL }}" class="mr-2">
<img <img
src="{{ $logo.RelPermalink }}" src="{{ $logo.RelPermalink }}"
width="{{ div $logo.Width 2 }}" width="{{ div $logo.Width 2 }}"
height="{{ div $logo.Height 2 }}" height="{{ div $logo.Height 2 }}"
class="max-h-[10rem] max-w-[10rem] object-scale-down object-left" class="max-h-[10rem] max-w-[10rem] object-scale-down object-left{{if $logo_dark }} hidden dark:flex{{end}}"
alt="{{ .Site.Title }}" alt="{{ .Site.Title }}"
/> />
{{- if $logo_dark }}
<img
src="{{ $logo_dark.RelPermalink }}"
width="{{ div $logo_dark.Width 2 }}"
height="{{ div $logo_dark.Height 2 }}"
class="max-h-[10rem] max-w-[10rem] object-scale-down object-left dark:hidden"
alt="{{ .Site.Title }}"
/>
{{- end}}
</a> </a>
{{- end }} {{- end }}
{{- end }} {{- end }}