Add menu with other case blog posts

master
Quentin Duchemin 2021-05-19 18:24:05 +02:00
parent 0308ea1a5d
commit 925d342b97
Signed by: Chosto
GPG Key ID: 0547178FEEDE7D6B
1 changed files with 22 additions and 0 deletions

View File

@ -16,6 +16,28 @@
{{ end }}
</div>
</aside>
<!--
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 }}
<aside class="menu" id="case">
<p class="menu-label">
Dans le dossier « {{ . }} »...
</p>
<ul class="menu-list">
{{ $posts := (where $.Site.RegularPages "CurrentSection.Params.Code" "==" $.CurrentSection.Params.Code )}}
{{ $postsSorted := (sort $posts "Date" )}}
{{ range $postsSorted }}
<li><a
{{ if eq $.Title .Title }}
class="is-active"
{{ end }}
href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</aside>
{{ end }}
<section id="main">
<h1 id="title">{{ .Title }}</h1>
<div>