Keeps logo size across languages and resolves mobile menu overlap (#68)
All checks were successful
/ build (push) Successful in 1m14s
/ accessibility (push) Successful in 2m2s

## Header

![image](/attachments/dd741d30-ffbe-49ad-b717-cd3e7bd46bcb)

## Mobile menu
| | |
| --- | --- |
| ![localhost_8888_en_ (1)](/attachments/ce78aa3d-b229-457a-add5-0d5e3ddc71ec) | ![localhost_8888_en_](/attachments/ae1832d5-605d-4bd5-b41a-b7fe9d6e14e5) |

Reviewed-on: #68
This commit is contained in:
Vincent Mahnke 2026-11-07 21:28:53 +01:00 • committed by stb
commit 75a8d446e4
9 changed files with 483 additions and 102 deletions

View file

@ -48,3 +48,4 @@ og:image:alt.
{{- end -}}
{{- end -}}
{{- end -}}

View file

@ -0,0 +1,12 @@
{{- /*
Render a Lucide icon from the local icons data file.
Usage: {{ partial "icon" "house" }}
Icons are fetched from data/lucideicons.json at build time
*/ -}}
{{- $iconName := . -}}
{{- with index hugo.Data.lucideicons $iconName -}}
{{- . | safeHTML -}}
{{- else -}}
{{- /* Fallback if icon not found */ -}}
<svg class="icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" focusable="false" aria-hidden="true"><circle cx="12" cy="12" r="10"/></svg>
{{- end -}}

View file

@ -0,0 +1,14 @@
{{- /* Inline language selector for mobile bottom nav */ -}}
<ul class="mobile-bottom-nav__lang-list">
{{ if .IsTranslated -}}
{{ range .Translations -}}
<li><a rel="alternate" href="{{ .RelPermalink }}" hreflang="{{ .Site.Language.Locale | default .Language.Name }}" lang="{{ .Site.Language.Locale | default .Language.Name }}">{{ .Language.Label }}</a></li>
{{ end -}}
{{ else -}}
{{ range hugo.Sites -}}
{{ if ne $.Language.Name .Language.Name -}}
<li><a rel="alternate" href="{{ .Home.RelPermalink }}" hreflang="{{ .Language.Locale | default .Language.Name }}" lang="{{ .Language.Locale | default .Language.Name }}">{{ .Language.Label }}</a></li>
{{ end -}}
{{ end -}}
{{ end -}}
</ul>

View file

@ -0,0 +1,21 @@
{{- /* Keep the translation icon inside the link so the entire language row is clickable.
Compare with the theme's language-selector.html after updating Zen. */ -}}
{{- $icon := `<svg version="1.0" xmlns="http://www.w3.org/2000/svg" class="language-icon" width="24" height="24" viewBox="0 0 961 1113" aria-hidden="true" focusable="false">
<path d="M848 3a17654 17654 0 00-349 118l-39 13-6 2-171-60-173-62c-2 0-2 6-2 118v119l-50 16-53 19c-5 3-5-19-5 343 0 335 0 336 2 339l6 5a92499 92499 0 00459-150l12-4 10 3 467 148 4 2V302l-45-15-45-14-1-132c0-124-1-132-2-134-4-7-9-8-19-5zm-4 145l-1 117-178-57-178-57L843 30l1 118zM458 481l-1 319-216 72-216 72V305l215-72 217-72 1 320zm262-131c17 4 30 9 30 9 1 0 20 67 42 149l57 203 15 56-64-19a2060 2060 0 01-24-84 2094 2094 0 00-130-40l-15 33-14 34-64-18 22-55 55-136 46-112c10-24 13-30 14-30l31 10z"/>
<path d="M257 360l-35 9c-23 7-25 7-34 7a72 72 0 01-20-3c-1 1 2 11 5 18 4 8 13 17 23 21 6 3 7 3 18 3 19 0 37-6 52-17 12-8 16-18 15-29-2-11-8-13-24-9zM335 413l-35 16c-13 7-23 12-28 13l-38 12a1636 1636 0 01-106 32c-19 3-17 2-17 9l2 8c2 4 9 10 14 12 12 6 42 3 51-6 2-2 3-3 3-7v-6l31-10 40-11a515 515 0 0148-13l-48 96c-10 19-23 40-45 71l-52 71-55 64-7 8h4c7 0 17-2 20-4a929 929 0 00149-179l23 17c26 20 30 23 51 35 25 14 39 21 56 27 8 2 12 3 13 1 1-4-6-30-9-33l-26-12-47-20-40-17-16-7 10-17c22-35 34-56 53-95l20-40 1-10v-11h-3l-17 6zM716 451l-23 56-23 55 86 26a4814 4814 0 00-40-137zM680 972a460 460 0 0026 44 422 422 0 01-319 66 517 517 0 01-175-66c-7-3-14-2-17 4-2 3-2 9 0 12s24 16 46 27a536 536 0 00222 53c36 1 39 0 68-4a480 480 0 00181-65l8-5 12 21 13 19 7-19 17-48 10-32-99-7z"/>
</svg>` -}}
<nav class="language-selector layout__language-selector" aria-label="{{ i18n "lang_select_title" }}">
<ul class="flex-inline mx--0">
{{ if .IsTranslated -}}
{{ range .Translations -}}
<li><a rel="alternate" href="{{ .RelPermalink }}" hreflang="{{ .Site.Language.Locale | default .Language.Name }}" lang="{{ .Site.Language.Locale | default .Language.Name }}">{{ $icon | safeHTML }}<span>{{ .Language.Label }}</span></a></li>
{{ end -}}
{{ else -}}
{{ range hugo.Sites -}}
{{ if ne $.Language.Name .Language.Name -}}
<li><a rel="alternate" href="{{ .Home.RelPermalink }}" hreflang="{{ .Language.Locale | default .Language.Name }}" lang="{{ .Language.Locale | default .Language.Name }}">{{ $icon | safeHTML }}<span>{{ .Language.Label }}</span></a></li>
{{ end -}}
{{ end -}}
{{ end -}}
</ul>
</nav>

View file

@ -0,0 +1,15 @@
{{- with .File -}}
{{- $file := . -}}
{{- $source := readFile .Filename -}}
{{- range $index, $line := split $source "\n" -}}
{{- if not (findRE `(?:#\s*hackertours-lint-ignore|<!--\s*hackertours-lint-ignore\s*-->)\s*$` $line) -}}
{{- $text := replaceRE `\]\([^)]*\)` "]" $line -}}
{{- $text = replaceRE `(?i)(?:https?://|mailto:|www\.)[^\s<>"']+|[[:alnum:]._%+-]+@[[:alnum:]._-]+|@[[:alnum:]_]+|#[[:alnum:]_-]+:[[:alnum:]._-]+` "" $text -}}
{{- range findRE `(?i)\bhackertours\b` $text -}}
{{- if ne . "Hackertours" -}}
{{- errorf "%s:%d: %q should be \"Hackertours\" (different casing) - to ignore this, add a hackertours-lint-ignore comment on this line" $file.Filename (add $index 1) . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}

View file

@ -1,22 +1,38 @@
<div class="mobile-nav" dir="ltr" hidden>
<div class="mobile-nav__cover"></div>
<button class="mobile-nav__toggle button{{ if $.Param "mobilemenuoutline" }} button--outline{{ end }}" aria-expanded="false" aria-controls="sheet">
{{ i18n "menu_mobile" }}
<svg class="mobile-nav__hamburger" viewBox="0 0 100 100" focusable="false" aria-hidden="true">
<rect width="80" height="12" x="10" y="20" rx="5"></rect>
<rect width="80" height="12" x="10" y="45" rx="5"></rect>
<rect width="80" height="12" x="10" y="70" rx="5"></rect>
</svg>
</button>
<div class="mobile-nav__sheet link-nav" id="sheet" data-theme="dark" aria-hidden="true">
<div class="mobile-nav__region">{{ if hugo.IsMultilingual }}{{ partial "language-selector.html" . }}{{ end }}</div>
<nav class="mobile-nav__main-menu" aria-label="{{ i18n "menu_title" }}">
<ul class="mobile-nav__navbar">
<nav class="mobile-bottom-nav" aria-label="{{ i18n "menu_title" }}">
<ul class="mobile-bottom-nav__list">
{{ $currentPage := . -}}
{{ range site.Menus.main -}}
<li><a href="{{ .URL }}"{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} aria-current="page"{{ end }}>{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}</a></li>
<li class="mobile-bottom-nav__item">
<a href="{{ .URL }}" class="mobile-bottom-nav__link" {{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}aria-current="page"{{ end }} aria-label="{{ .Name }}">
{{ if eq .Name "Home" }}
{{ partial "icon" "house" }}
{{ else if eq .Name "News" }}
{{ partial "icon" "rss" }}
{{ else if eq .Name "Touren" "Tours" }}
{{ partial "icon" "calendar" }}
{{ else if eq .Name "FAQ" }}
{{ partial "icon" "circle-question-mark" }}
{{ else }}
{{ .Pre }}{{ .Post }}
{{ end }}
<span class="mobile-bottom-nav__label">{{ .Name }}</span>
</a>
</li>
{{ end -}}
</ul>
</nav>
</div>
</div>
{{ if hugo.IsMultilingual }}
<li class="mobile-bottom-nav__item">
{{ if eq .Lang "en" }}
<a href="{{ .Permalink | replaceRE "/en/" "/de/" }}" class="mobile-bottom-nav__link" aria-label="Deutsch" rel="alternate" hreflang="de">
{{ partial "icon" "languages" }}
<span class="mobile-bottom-nav__label">Deutsch</span>
</a>
{{ else }}
<a href="{{ .Permalink | replaceRE "/de/" "/en/" }}" class="mobile-bottom-nav__link" aria-label="English" rel="alternate" hreflang="en">
{{ partial "icon" "languages" }}
<span class="mobile-bottom-nav__label">English</span>
</a>
{{ end }}
</li>
{{ end }}
</ul>
</nav>

View file

@ -1,3 +1,4 @@
{{ partial "lint-brand.html" . }}
<!DOCTYPE html>
<html class="nojs" lang="{{ site.Language.Locale | default site.Language.Name }}" dir="{{ site.Language.Direction | default "ltr" }}"{{ with $.Param "colorScheme" }} data-theme="{{ . }}"{{ end }}>
<head>
@ -26,10 +27,9 @@
<img src="{{ with $.Param "logopath" }}{{ . | relURL }}{{ else }}{{ "images/logo.png" | relURL }}{{ end }}"{{ with $.Param "logowidth" }} width="{{ . }}"{{ end }}{{ with $.Param "logoheight" }} height="{{ . }}"{{ end }} alt="{{ i18n "logo_alt" }}" class="header__logo-image">
</a>
{{ end -}}
<div class="header__intro">
<div class="header__intro_headline"><a href="{{ site.Home.RelPermalink }}" class="header__site-link" rel="home"><span>{{ site.Title }}</span></a></div>
<div class="header__intro_text">{{ .Param "intro" }}</div>
</div>
<h1 class="header__site-name">
<a href="{{ site.Home.RelPermalink }}" rel="home" class="header__site-link">{{ site.Title }}</a>
</h1>
<div class="region header__region">
{{ if hugo.IsMultilingual }}{{ partial "language-selector.html" . }}{{ end -}}
{{ if $.Param "menuinheader" }}{{ partial "menu.html" . }}{{ end -}}

View file

@ -1,3 +1,4 @@
{{ partial "lint-brand.html" . }}
<!DOCTYPE html>
<html class="nojs" lang="{{ site.Language.Locale | default site.Language.Name }}" dir="{{ site.Language.Direction | default "ltr" }}"{{ with $.Param "colorScheme" }} data-theme="{{ . }}"{{ end }}>
<head>
@ -26,12 +27,9 @@
<img src="{{ with $.Param "logopath" }}{{ . | relURL }}{{ else }}{{ "images/logo.png" | relURL }}{{ end }}"{{ with $.Param "logowidth" }} width="{{ . }}"{{ end }}{{ with $.Param "logoheight" }} height="{{ . }}"{{ end }} alt="{{ i18n "logo_alt" }}" class="header__logo-image">
</a>
{{ end -}}
<div class="header__intro">
<h1 class="header__intro_headline">{{ .Param "headline" }}</h1>
{{ if .Param "intro" }}
<div class="header__intro_text">{{ .Param "intro" }}</div>
{{ end }}
</div>
<h1 class="header__site-name">
<a href="{{ site.Home.RelPermalink }}" rel="home" class="header__site-link">{{ site.Title }}</a>
</h1>
<div class="region header__region">
{{ if hugo.IsMultilingual }}{{ partial "language-selector.html" . }}{{ end -}}
{{ if $.Param "menuinheader" }}{{ partial "menu.html" . }}{{ end -}}

View file

@ -2,6 +2,13 @@
{{ define "main" -}}
<main class="main layout__main">
<header>
<h1 class="title">{{ .Title }}</h1>
</header>
{{ if .Param "intro" }}
<div class="intro-text">{{ .Param "intro" }}</div>
{{ end }}
{{ .Content }}
{{ $pages := .Site.RegularPages.RelatedTo (keyVals "tags" "current-event") -}}