Juli 2025

This commit is contained in:
Markus 2025-07-24 00:03:22 +02:00
parent 9df489d983
commit 940295ac2e
5 changed files with 55 additions and 42 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -3,6 +3,7 @@
favicon = "images/amperion_logo.webp"
# logo
logo = "images/Schrift_1.webp"
logo_hover = "images/Schrift_2.webp"
# use `px` or `x` with logo_width, example: "100px".
# Note: logo_width is not work with .svg file
logo_width = "200px"

View file

@ -1,50 +1,62 @@
{{ $logoPath:= site.Params.logo }}
{{ $logoWidth:= replace site.Params.logo_width "px" "x" }}
{{ $logoPath := site.Params.logo }}
{{ $logoHoverPath := site.Params.logo_hover }} <!-- Neuer Parameter für das Hover-Logo -->
{{ $logoWidth := replace site.Params.logo_width "px" "x" }}
<!-- checking logo existance -->
<!-- Überprüfen, ob das Logo existiert -->
{{ if $logoPath }}
{{ if fileExists (add `assets/` $logoPath) }}
{{ $logo:= resources.Get $logoPath }}
{{ if fileExists (add `assets/` $logoPath) }}
{{ $logo := resources.Get $logoPath }}
{{ $logoExt := path.Ext $logo }}
<!-- logo extention -->
{{ $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 }}
<!-- logo height, width (if not 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" }}
{{ $logoDefaultWidth := .Scratch.Get "logo-width" }}
{{ $logoDefaultHeight := .Scratch.Get "logo-height" }}
<!-- checking gif -->
{{ if eq $logoExt ".gif" }}
{{ .Scratch.Set "logo" ($logo.Resize $logoWidth).RelPermalink }}
<!-- checking svg -->
{{ else if eq $logoExt ".svg"}}
{{ .Scratch.Set "logo" $logo.RelPermalink }}
<!-- logo processing to webp -->
{{ else }}
{{ $logoDefaultWidth:= add (string $logoDefaultWidth) "x"}}
{{ $logoWidth:= $logoWidth | default $logoDefaultWidth }}
{{ $options := add (string $logoWidth) " webp" }}
{{ .Scratch.Set "logo" ($logo.Resize $options).RelPermalink }}
<!-- logo fallback -->
{{ .Scratch.Set "logo_fallback" ($logo.Resize $logoWidth).RelPermalink }}
{{ end }}
<!-- Ü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 }}
<img loading="prelaod" 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`}}'">
{{ else }}
<strong class="text-danger">`{{$logoPath}}` doesn't exist</strong>
{{ end }}
<!-- / checking logo existance -->
<!-- logo text -->
<!-- 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 }}
<!-- logo title -->
{{ site.Params.logo_text | markdownify }}
{{ else }}
{{ site.Title | markdownify }}
{{ end }}
{{ site.Title | markdownify }}
{{ end }}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB