2021-05-21 14:53:35 +02:00
|
|
|
<nav class="navbar is-fixed-top is-transparent" role="navigation" aria-label="main navigation">
|
|
|
|
<div class="navbar-brand">
|
|
|
|
<a class="navbar-item" href="{{ .Site.Home.Permalink }}">
|
2021-05-27 00:52:36 +02:00
|
|
|
{{ $imageURL := "https://bulma.io/images/placeholders/64x64.png" }}
|
|
|
|
{{ $image := resources.Get "img/logo.jpg" }}
|
|
|
|
|
|
|
|
{{ with $image }}
|
2021-05-27 02:33:35 +02:00
|
|
|
{{ $imageResized := $image.Resize "64x" }}
|
|
|
|
{{ $imageURL = $imageResized.Permalink }}
|
2021-05-27 00:52:36 +02:00
|
|
|
{{ end }}
|
|
|
|
<img src="{{ $imageURL }}">
|
2021-05-21 14:53:35 +02:00
|
|
|
</a>
|
|
|
|
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbar">
|
|
|
|
<span aria-hidden="true"></span>
|
|
|
|
<span aria-hidden="true"></span>
|
|
|
|
<span aria-hidden="true"></span>
|
|
|
|
</a>
|
2021-05-24 23:53:06 +02:00
|
|
|
</div>
|
|
|
|
<div id="navbar" class="navbar-menu">
|
|
|
|
<!-- In case of another navbar-start right after -->
|
|
|
|
<div class="navbar-start mr-0">
|
|
|
|
<div class="navbar-item has-dropdown is-hoverable">
|
|
|
|
<a class="navbar-link">
|
|
|
|
Catégories
|
|
|
|
</a>
|
|
|
|
<div class="navbar-dropdown">
|
|
|
|
{{ range $key, $value := .Site.Taxonomies.categories }}
|
|
|
|
<a class="navbar-item {{ if eq $.Permalink .Page.Permalink }}is-active{{ end }}" href="{{ .Page.Permalink }}">
|
|
|
|
{{ $key | humanize }}
|
|
|
|
<span class="tag ml-2 is-rounded">{{ len . }}</span>
|
2021-05-22 00:16:10 +02:00
|
|
|
</a>
|
2021-05-24 23:53:06 +02:00
|
|
|
{{ end }}
|
2021-05-22 00:16:10 +02:00
|
|
|
</div>
|
2021-05-24 23:53:06 +02:00
|
|
|
</div>
|
|
|
|
<div class="navbar-item has-dropdown is-hoverable">
|
|
|
|
<a class="navbar-link">
|
|
|
|
Dossiers
|
|
|
|
</a>
|
|
|
|
<div class="navbar-dropdown">
|
|
|
|
{{ range where .Site.Pages "Params.Code" "!=" nil }}
|
|
|
|
<a class="navbar-item {{ if eq $.Permalink .Page.Permalink }}is-active{{ end }}" href="{{ .Page.Permalink }}">
|
2022-11-06 22:58:22 +01:00
|
|
|
{{ .Title }}
|
2021-05-24 23:53:06 +02:00
|
|
|
{{ $casePosts := where .Site.RegularPages "CurrentSection.Params.Code" "==" .Params.Code }}
|
|
|
|
<span class="tag ml-2 is-rounded">{{ len $casePosts }}</span>
|
2021-05-21 14:53:35 +02:00
|
|
|
</a>
|
2021-05-24 23:53:06 +02:00
|
|
|
{{ end }}
|
2021-05-21 14:53:35 +02:00
|
|
|
</div>
|
2021-05-21 23:50:10 +02:00
|
|
|
</div>
|
2021-05-21 14:53:35 +02:00
|
|
|
</div>
|
2021-05-24 23:53:06 +02:00
|
|
|
<!-- start/end menu shares the exact same code, just not the same position, factorize with a loop -->
|
|
|
|
{{ $currentPage := . }}
|
|
|
|
{{ range (slice "start" "end")}}
|
2021-05-25 02:39:24 +02:00
|
|
|
{{ $menuName := . }}
|
2021-05-24 23:53:06 +02:00
|
|
|
<div class="navbar-{{ . }} mr-2">
|
|
|
|
<!-- now get the menu if it exists -->
|
2021-05-25 02:39:24 +02:00
|
|
|
{{ with index $.Site.Menus $menuName }}
|
2021-05-24 23:53:06 +02:00
|
|
|
<!-- and range over its pages -->
|
|
|
|
{{ range . }}
|
|
|
|
{{ if .HasChildren }}
|
2021-05-25 02:39:24 +02:00
|
|
|
<div class="navbar-item has-dropdown is-hoverable {{ if $currentPage.HasMenuCurrent $menuName . }}is-active is-tab{{ end }}">
|
2021-05-24 23:53:06 +02:00
|
|
|
<a class="navbar-link">
|
|
|
|
{{ .Pre }}
|
|
|
|
<span>{{ .Name }}</span>
|
|
|
|
</a>
|
|
|
|
<div class="navbar-dropdown">
|
|
|
|
{{ range .Children }}
|
2021-05-25 02:39:24 +02:00
|
|
|
<a class="navbar-item {{ if $currentPage.IsMenuCurrent $menuName . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
|
2021-05-24 23:53:06 +02:00
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{ else }}
|
2021-05-25 02:39:24 +02:00
|
|
|
<a class="navbar-item {{ if $currentPage.IsMenuCurrent $menuName . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
|
2021-05-24 23:53:06 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
2021-05-27 02:33:35 +02:00
|
|
|
{{ end }}
|
|
|
|
</div>
|
2021-05-24 23:53:06 +02:00
|
|
|
{{ end }}
|
2021-05-27 02:33:35 +02:00
|
|
|
<div class="navbar-end ml-0 mr-4">
|
|
|
|
<div class="level">
|
|
|
|
<div class="level-left">
|
|
|
|
<div class="level-item">
|
|
|
|
<!-- Each item should have a corresponding assets/img/x.png and link in config.yaml -->
|
2022-11-05 20:16:36 +01:00
|
|
|
{{ range (slice "rss" "mastodon" "peertube" "funkwhale" "gitea" "github" "mail" )}}
|
2021-05-27 02:33:35 +02:00
|
|
|
{{ $imageName := . }}
|
|
|
|
<!-- Get image and resize to logo size -->
|
|
|
|
{{ $imagePath := printf "img/%s.png" $imageName }}
|
|
|
|
{{ $image := resources.Get $imagePath }}
|
|
|
|
{{ $imageResized := $image.Resize "64x" }}
|
|
|
|
<!-- Get logo link in site params (index allows to use a dynamic parameter name) -->
|
|
|
|
<a class="navbar-item" href="{{ index $.Site.Params $imageName }}">
|
|
|
|
<img src="{{ $imageResized.Permalink }}">
|
|
|
|
</a>
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-05-21 14:53:35 +02:00
|
|
|
</div>
|
2021-05-18 17:07:00 +02:00
|
|
|
</nav>
|
2022-11-05 23:12:24 +01:00
|
|
|
<script>
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
|
|
|
|
// Get all "navbar-burger" elements
|
|
|
|
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
|
|
|
|
|
|
|
|
// Add a click event on each of them
|
|
|
|
$navbarBurgers.forEach( el => {
|
|
|
|
el.addEventListener('click', () => {
|
|
|
|
|
|
|
|
// Get the target from the "data-target" attribute
|
|
|
|
const target = el.dataset.target;
|
|
|
|
const $target = document.getElementById(target);
|
|
|
|
|
|
|
|
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
|
|
|
|
el.classList.toggle('is-active');
|
|
|
|
$target.classList.toggle('is-active');
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|