{{ $logoPath := site.Params.logo }} {{ $logoHoverPath := site.Params.logo_hover }} {{ $logoWidth := replace site.Params.logo_width "px" "x" }} {{ if $logoPath }} {{ if fileExists (add `assets/` $logoPath) }} {{ $logo := resources.Get $logoPath }} {{ $logoExt := path.Ext $logo }} {{ if eq $logoExt `.svg` }} {{ .Scratch.Set "logo-width" "" }} {{ .Scratch.Set "logo-height" "" }} {{ else }} {{ .Scratch.Set "logo-width" $logo.Width }} {{ .Scratch.Set "logo-height" $logo.Height }} {{ end }} {{ $logoDefaultWidth := .Scratch.Get "logo-width" }} {{ $logoDefaultHeight := .Scratch.Get "logo-height" }} {{ if eq $logoExt ".gif" }} {{ .Scratch.Set "logo" ($logo.Resize $logoWidth).RelPermalink }} {{ else if eq $logoExt ".svg" }} {{ .Scratch.Set "logo" $logo.RelPermalink }} {{ else }} {{ $logoDefaultWidth := add (string $logoDefaultWidth) "x" }} {{ $logoWidth := $logoWidth | default $logoDefaultWidth }} {{ $options := add (string $logoWidth) " webp" }} {{ .Scratch.Set "logo" ($logo.Resize $options).RelPermalink }} {{ .Scratch.Set "logo_fallback" ($logo.Resize $logoWidth).RelPermalink }} {{ end }} {{ if $logoHoverPath }} {{ if fileExists (add `assets/` $logoHoverPath) }} {{ $logoHover := resources.Get $logoHoverPath }} {{ $logoHoverExt := path.Ext $logoHover }} {{ if eq $logoHoverExt ".gif" }} {{ .Scratch.Set "logo_hover" ($logoHover.Resize $logoWidth).RelPermalink }} {{ else if eq $logoHoverExt ".svg" }} {{ .Scratch.Set "logo_hover" $logoHover.RelPermalink }} {{ else }} {{ $optionsHover := add (string $logoWidth) " webp" }} {{ .Scratch.Set "logo_hover" ($logoHover.Resize $optionsHover).RelPermalink }} {{ .Scratch.Set "logo_hover_fallback" ($logoHover.Resize $logoWidth).RelPermalink }} {{ end }} {{ end }} {{ end }} {{ site.Title }} {{ else }} `{{ $logoPath }}` doesn't exist {{ end }} {{ else if site.Params.logo_text }} {{ site.Params.logo_text | markdownify }} {{ else }} {{ site.Title | markdownify }} {{ end }}