62 lines
2.8 KiB
HTML
62 lines
2.8 KiB
HTML
{{ $logoPath := site.Params.logo }}
|
|
{{ $logoHoverPath := site.Params.logo_hover }} <!-- Neuer Parameter für das Hover-Logo -->
|
|
{{ $logoWidth := replace site.Params.logo_width "px" "x" }}
|
|
|
|
<!-- Überprüfen, ob das Logo existiert -->
|
|
{{ if $logoPath }}
|
|
{{ if fileExists (add `assets/` $logoPath) }}
|
|
{{ $logo := resources.Get $logoPath }}
|
|
{{ $logoExt := path.Ext $logo }}
|
|
|
|
<!-- Logo-Höhe und -Breite (wenn nicht SVG) -->
|
|
{{ 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" }}
|
|
|
|
<!-- Überprüfen, ob das Logo ein GIF ist -->
|
|
{{ 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 }}
|
|
|
|
<!-- Hover-Logo laden -->
|
|
{{ 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 }}
|
|
|
|
<!-- Logo anzeigen -->
|
|
<img loading="preload" decoding="async" class="img-fluid logo-up" width="{{ replace $logoWidth `x` `` | default $logoDefaultWidth }}" height="{{ $logoDefaultHeight }}" src="{{ .Scratch.Get `logo` }}" alt="{{ site.Title }}" onerror="this.onerror=null;this.src='{{ .Scratch.Get `logo_fallback` }}'" onmouseover="this.src='{{ .Scratch.Get `logo_hover` }}'" onmouseout="this.src='{{ .Scratch.Get `logo` }}'">
|
|
{{ else }}
|
|
<strong class="text-danger">`{{ $logoPath }}` doesn't exist</strong>
|
|
{{ end }}
|
|
{{ else if site.Params.logo_text }}
|
|
{{ site.Params.logo_text | markdownify }}
|
|
{{ else }}
|
|
{{ site.Title | markdownify }}
|
|
{{ end }}
|