forked from laurens/fediversity_website
		
	
		
			
				
	
	
		
			86 lines
		
	
	
	
		
			4.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			86 lines
		
	
	
	
		
			4.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {{ $.Scratch.Set "counter" 0 }}
 | |
| {{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
 | |
| 
 | |
| <header>
 | |
|   <div class="header-content">
 | |
| 
 | |
|     <!-- Logo wordt nu benoemd als URL, dus we strippen de eerste slash, vervolgens halen we deze uit de assets directory -->
 | |
|     <!-- Logo staat zowel in assets als static, zodat deze gekopieerd worden. Dit is een TODO om te ontdubbelen -->
 | |
|     {{ $logoresource := resources.Get (.Site.Params.logoNormal | replaceRE "^/" "") }}
 | |
| 
 | |
|     <a class="logo" href="{{ "/" | relLangURL }}" title="{{ strings.FirstUpper (i18n "back_to_home") }}">
 | |
|       <figure>
 | |
|         <picture>
 | |
|           {{ $isJPG := eq (path.Ext $logoresource) ".jpg" }}
 | |
|           {{ $isPNG := eq (path.Ext $logoresource) ".png" }}
 | |
| 
 | |
|           {{ if ($isJPG) -}}
 | |
|             {{ $webpPath:= replace $logoresource ".jpg" ".webp" }}
 | |
|             {{ $webpPathStatic:= printf "assets/%s" $webpPath }}
 | |
| 
 | |
|             {{ if (fileExists $webpPathStatic) -}}
 | |
|               <source srcset="/{{ $webpPath | safeURL }}" type="image/webp">
 | |
|             {{- end }}
 | |
|           {{- end }}
 | |
| 
 | |
|           {{ if ($isPNG) -}}
 | |
|             {{ $webpPath:= replace $logoresource ".png" ".webp" }}
 | |
|             {{ $webpPathStatic:= printf "assets/%s" $webpPath }}
 | |
| 
 | |
|             {{ if (fileExists $webpPathStatic) -}}
 | |
|               <source srcset="/{{ $webpPath | safeURL }}" type="image/webp">
 | |
|             {{- end }}
 | |
|           {{- end }}
 | |
| 
 | |
|           <img class="max-width" src="{{ .Site.Params.logoNormal | safeURL }}" alt="NLUUG-logo" decoding="async" width="{{ $logoresource.Width }}" height="{{ $logoresource.Height }}">
 | |
|         </picture>
 | |
|       </figure>
 | |
|     </a>
 | |
| 
 | |
| <!--
 | |
|     TODO (2023-06-18) - Deze regel mag weg als blijkt dat bovenstaande manier van laden van het logo goed functioneert
 | |
|     <a href="{{ "/" | relLangURL }}" class="logo" title="{{ strings.FirstUpper (i18n "back_to_home") }}"><img class="max-width" src="{{ $logoresource | relURL }}" alt="NLUUG-logo" width="{{ $logoresource.Width }}" height="{{ $logoresource.Height }}"></a>
 | |
| -->
 | |
|     <input type="checkbox" id="hamburger" aria-label="menu button">
 | |
|     <label for="hamburger"><span></span></label>
 | |
| 
 | |
|     <nav aria-label="Main navigation">
 | |
| 
 | |
|        <ul class="menus menu">
 | |
|            {{ $currentPage := . }}
 | |
|            {{ range .Site.Menus.main }}
 | |
|              {{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
 | |
|              {{ if .Children }}
 | |
|                <li>
 | |
|                  <!-- <button type="button" aria-haspopup="true" aria-expanded="true" aria-controls="dropdown-{{ $.Scratch.Get "counter" }}" aria-labelledby="button-link-{{ $.Scratch.Get "counter" }}"></button> -->
 | |
|                  <a id="button-link-{{ $.Scratch.Get "counter" }}" href="{{ .URL }}">{{ or (T .Identifier) .Name | strings.FirstUpper | safeHTML }}</a>
 | |
|                  <ul class="dropdown" id="dropdown-{{ $.Scratch.Get "counter" }}">
 | |
|                    {{ range .Children }}
 | |
|                      <li><a href="{{ .URL }}">{{ or (T .Identifier) .Name | strings.FirstUpper | safeHTML }}</a></li>
 | |
|                    {{ end }}
 | |
|                  </ul>
 | |
|                </li>
 | |
|              {{ else }}
 | |
|              <li>
 | |
|                <!-- <button type="button" aria-haspopup="true" aria-expanded="true" aria-labelledby="button-link-{{ $.Scratch.Get "counter" }}"></button> -->
 | |
|                <a id="button-link-{{ $.Scratch.Get "counter" }}" href="{{ .URL }}">{{ or (T .Identifier) .Name | strings.FirstUpper | safeHTML }}</a>
 | |
|              </li>
 | |
|              {{ end }}
 | |
|            {{ end }}
 | |
|            <li>
 | |
|              {{ $search := safeHTML (strings.FirstUpper (i18n "search")) }}
 | |
|              <!-- <button type="button" aria-haspopup="false" aria-expanded="true" aria-label="{{ $search }}"></button> -->
 | |
|              <a href="{{ relLangURL "/zoeken/" }}">
 | |
|                {{ partial "show-svg-icon.html" (dict "context" . "icon" "magnifying-glass" "title" $search) }}
 | |
|              </a>
 | |
|            </li>
 | |
|            <li>
 | |
|              {{ $text := safeHTML (strings.FirstUpper (i18n "ledendeel")) }}
 | |
|              <a href="https://leden.nluug.nl/leden/">
 | |
|                {{ partial "show-svg-icon.html" (dict "context" . "icon" "user" "title" $text) }}
 | |
|              </a>
 | |
|            </li>
 | |
|          </ul>
 | |
|     </nav>
 | |
|   </div>
 | |
| </header>
 |