♻️ adhesive_bandage: adapt logo partial to use picture partial to render the logo. Add SVG Gorilla to example site as functional demo.

pull/738/head
Wolf Noble 2023-12-04 20:44:42 -06:00
parent dbf421848f
commit 843506a7f2
3 changed files with 28 additions and 25 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -20,8 +20,8 @@ fingerprintAlgorithm = "sha256"
[header] [header]
layout = "basic" # valid options: basic, hamburger, hybrid, custom layout = "basic" # valid options: basic, hamburger, hybrid, custom
# logo = "img/logo.jpg" logo = "img/logo.jpg"
# logoDark = "img/dark-logo.jpg" logoDark = "img/dark-logo.svg"
showTitle = true showTitle = true
[footer] [footer]

View File

@ -1,28 +1,26 @@
{{- if .Site.Params.header.logo }} {{- if $.Page.Site.Params.header.logo }}
{{- $logo := resources.Get .Site.Params.header.logo }} {{- $logo := resources.Get $.Page.Site.Params.header.logo }}
{{- $logo_dark := resources.Get .Site.Params.header.logoDark }} {{- $logo_dark := resources.Get $.Page.Site.Params.header.logoDark }}
{{- if $logo }} {{- $logoAlt := $.Page.Site.Title -}}
{{- $logoClass := "max-h-[10rem] max-w-[10rem] object-scale-down object-left flex" -}}
{{- $logoDarkClass := (print $logoClass " hidden dark:flex") -}}
{{- if $logo_dark -}}
{{- $logoClass = (print $logoClass " dark:hidden" ) -}}
{{- end }}
{{- if or $logo $logo_dark -}}
<a href="{{ "" | relLangURL }}" class="mr-2"> <a href="{{ "" | relLangURL }}" class="mr-2">
<img {{- end }}
src="{{ $logo.RelPermalink }}" {{- with $logo }}
width="{{ div $logo.Width 2 }}" {{- partial "picture.html" (dict "img" . "alt" $logoAlt "class" $logoClass "lazy" false "webp" false ) -}}
height="{{ div $logo.Height 2 }}" {{- end -}}
class="max-h-[10rem] max-w-[10rem] object-scale-down object-left{{ if $logo_dark }} hidden dark:flex{{ end }}" {{- with $logo_dark }}
alt="{{ .Site.Title }}" {{- partial "picture.html" (dict "img" . "alt" $logoAlt "class" $logoDarkClass "lazy" false "webp" false ) -}}
/> {{- end -}}
{{- if $logo_dark }} {{- if or $logo $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 }}
{{- if .Site.Params.header.showTitle | default true }} {{- if $.Page.Site.Params.header.showTitle | default true }}
<a <a
class="decoration-primary-500 hover:underline hover:decoration-2 hover:underline-offset-2" class="decoration-primary-500 hover:underline hover:decoration-2 hover:underline-offset-2"
rel="me" rel="me"