diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 065b36fe..89bdad15 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -43,41 +43,60 @@ {{- $label_text := (site.Params.label.text | default site.Title) }} + {{- if site.Title }} - - {{- if site.Params.label.icon }} - {{- $img := resources.Get site.Params.label.icon }} - {{- if $img }} - {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}} - {{- if hugo.IsExtended -}} - {{- $processableFormats = $processableFormats | append "webp" -}} + + {{- if site.Params.label.icon -}} + {{- $img := resources.Get site.Params.label.icon -}} + + {{- if $img -}} + {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}} + + {{- if hugo.IsExtended -}} + {{- $processableFormats = $processableFormats | append "webp" -}} + {{- end -}} + + {{- $prod := (hugo.IsProduction | or (eq site.Params.env "production")) -}} + + {{- if and (in $processableFormats $img.MediaType.SubType) (eq $prod true) -}} + {{- if site.Params.label.iconHeight -}} + {{- $img = $img.Resize (printf "x%s" site.Params.label.iconHeight) -}} + + {{ else -}} + {{- $img = $img.Resize "x30" -}} + {{- end -}} + {{- end -}} + + + + {{- else }} + + {{- end -}} + + {{- else if hasPrefix site.Params.label.iconSVG " - {{- else }} - - {{- end -}} - {{- else if hasPrefix site.Params.label.iconSVG " + + {{- $label_text -}} + {{- end }} + {{- if (not site.Params.disableThemeToggle) }}