Add case menu

master
Quentin Duchemin 2021-05-22 00:16:10 +02:00
parent 526ba6d991
commit 9aaa1bf352
Signed by: Chosto
GPG Key ID: 0547178FEEDE7D6B
6 changed files with 30 additions and 27 deletions

View File

@ -12,6 +12,17 @@
{{ end }}
</div>
{{ end }}
<aside>
<div>
<section>
<time class="post-date" datetime="{{ .Date.Format `2006-01-02T15:04:05Z07:00` | safeHTML }}">
Article publié le {{ .Date.Day }} {{ index $.Site.Data.months_fr (printf "%d" .Date.Month) }} {{ .Date.Year }} (dernière modification le {{ .Lastmod.Day }} {{ index $.Site.Data.months_fr (printf "%d" .Lastmod.Month) }}
{{ .Lastmod.Year }})
</time>
<h4>{{ .FuzzyWordCount }} mots </h4>
</section>
</div>
</aside>
</div>
</section>
</header>

View File

@ -17,14 +17,13 @@
{{ $currentPostIndex := 1 }}
{{ $posts := (where $.Site.RegularPages "CurrentSection.Params.Code" "==" $.CurrentSection.Params.Code )}}
{{ $postsSorted := (sort $posts "Date" )}}
{{ $postCounts := len $postsSorted }}
{{ range $index, $element := $postsSorted }}
{{ if eq $element.Title $currentPost.Title }}
{{ $currentPostIndex = (add $index 1) }}
{{ end }}
{{ end }}
{{ with .CurrentSection.Params.Code }}
[{{ . }} {{ print $currentPostIndex }}/{{ print $postCounts }}]
[{{ . }}{{ print $currentPostIndex }}]
{{ end }}
{{ .Title }}
</a>

View File

@ -18,13 +18,27 @@
</a>
<div class="navbar-dropdown">
{{ range $key, $value := .Site.Taxonomies.categories }}
<a class="navbar-item" href="{{ .Page.Permalink }}">
<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>
</a>
{{ end }}
</div>
</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 }}">
{{ .Title | humanize }}
{{ $casePosts := where .Site.RegularPages "CurrentSection.Params.Code" "==" .Params.Code }}
<span class="tag ml-2 is-rounded">{{ len $casePosts }}</span>
</a>
{{ end }}
</div>
</div>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}

View File

@ -5,8 +5,7 @@
{{ .Content }}
</article>
<ul>
<!-- Ranges through content/posts/*.md -->
{{ range .Site.RegularPages }}
{{ range .Paginator.Pages }}
{{- partial "listitem.html" . -}}
{{ end }}
</ul>

View File

@ -4,10 +4,10 @@
If the current blog post belongs to a case, we will add a side menu
with all other blog posts belonging to that case, emphasis to the current.
-->
{{ with .CurrentSection.Params.Title }}
{{ with .CurrentSection }}
<aside class="menu box column is-3">
<p class="menu-label">
Dans le dossier « {{ . }} »...
Dans le dossier « <a href="{{ .Permalink }}">{{ .Params.Title }} »</a>...
</p>
<div class="menu-list">
{{ $posts := (where $.Site.RegularPages "CurrentSection.Params.Code" "==" $.CurrentSection.Params.Code )}}
@ -19,17 +19,6 @@
</aside>
{{ end }}
<section class="column is-7">
<aside>
<div>
<section>
<time class="post-date" datetime="{{ .Date.Format `2006-01-02T15:04:05Z07:00` | safeHTML }}">
Article publié le {{ .Date.Day }} {{ index $.Site.Data.months_fr (printf "%d" .Date.Month) }} {{ .Date.Year }} (dernière modification le {{ .Lastmod.Day }} {{ index $.Site.Data.months_fr (printf "%d" .Lastmod.Month) }}
{{ .Lastmod.Year }})
</time>
<h4>{{ .FuzzyWordCount }} mots </h4>
</section>
</div>
</aside>
<div>
<article>
{{ .Content }}

View File

@ -1,9 +0,0 @@
{{ define "main" }}
<main>
<ul>
{{ range .Data.Terms.Alphabetical }}
<li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li>
{{ end }}
</ul>
</main>
{{ end }}