menu: improve the menu

* Uses a regular method to generate the menu (`config.toml`).
* Improves the test to provide the good atom link according to the
  homepage, a section or a post.
* Provides a title to improve identification of the atom link.
* Adapts the menu style to mobile or wider screens.
* Adds and uses a mixin for inline lists.

Co-Authored-by: iGor milhit <igor@milhit.ch>
merge-requests/5/merge
iGor milhit 2021-10-24 14:24:43 +02:00
parent 7bba092f68
commit c0f6de2ab1
Signed by: igor
GPG Key ID: 692D97C3D0228A99
5 changed files with 67 additions and 11 deletions

View File

@ -12,10 +12,12 @@
margin-bottom: 1em; margin-bottom: 1em;
} }
@include inline-list;
li { li {
list-style: none;
margin-right: .5em; margin-right: .5em;
} }
} }
.smallcaps { .smallcaps {

View File

@ -10,6 +10,12 @@
flex-direction: column; flex-direction: column;
} }
@include breakpoint(tablet) {
section {
flex-direction: row;
}
}
header { header {
flex-grow: 1; flex-grow: 1;
} }
@ -27,6 +33,26 @@
} }
nav { nav {
align-self: flex-end; display: flex;
margin-right: .5em; justify-content: end;
@include breakpoint(tablet) {
flex-direction: column;
justify-content: center;
}
ul {
margin: 0;
padding: 0;
}
@include inline-list;
} }
.nav-item:not(:last-child) {
&::after {
content: ' /';
}
}

View File

@ -0,0 +1,12 @@
///////////////////
// //
// MIXINS //
// //
///////////////////
// Inline, no bullet lists
@mixin inline-list {
ul > li {
display: inline;
}
}

View File

@ -6,6 +6,7 @@
@import 'variables'; @import 'variables';
@import 'grid'; @import 'grid';
@import 'mixins';
@import 'colors'; @import 'colors';
@import 'fonts'; @import 'fonts';
@import 'footer'; @import 'footer';

View File

@ -6,14 +6,29 @@
<h1>{{ .Site.Title }}</h1></a> <h1>{{ .Site.Title }}</h1></a>
</header> </header>
<nav> <nav>
<a href="{{ .Site.BaseURL }}blog">Blog</a> / <ul>
<a href="{{ .Site.BaseURL }}categories">Catégories</a> {{ $currentPage := . -}}
{{ if .IsNode }} {{ range .Site.Menus.main -}}
/ <a href="{{ .Permalink }}index.xml"><span class="smallcaps">rss</a> <li class="nav-item">
{{ end }} <a class="nav-item-link{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a>
{{ if .IsPage }} </li>
/ <a href="{{ .Site.BaseURL }}index.xml"><span class="smallcaps">rss</a> {{ end -}}
{{ end }} <li class="nav-item">
{{ if .IsPage -}}
<a class="nav-item-link" href="{{ .Site.BaseURL }}index.xml"
title="S'abonner aux publications du site">S'abonner
</a>
{{ else if .IsHome -}}
<a class="nav-item-link" href="{{ .Site.BaseURL }}index.xml"
title="S'abonner aux publications du site">S'abonner
</a>
{{ else if .IsNode -}}
<a class="nav-item-link" href="{{ .Permalink }}index.xml"
title="S'abonner aux publications de cette section">S'abonner
</a>
{{ end -}}
</li>
</ul>
</nav> </nav>
</section> </section>
</header> </header>