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 }} {{ end }}
</div> </div>
{{ end }} {{ 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> </div>
</section> </section>
</header> </header>

View File

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

View File

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

View File

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

View File

@ -4,10 +4,10 @@
If the current blog post belongs to a case, we will add a side menu 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 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"> <aside class="menu box column is-3">
<p class="menu-label"> <p class="menu-label">
Dans le dossier « {{ . }} »... Dans le dossier « <a href="{{ .Permalink }}">{{ .Params.Title }} »</a>...
</p> </p>
<div class="menu-list"> <div class="menu-list">
{{ $posts := (where $.Site.RegularPages "CurrentSection.Params.Code" "==" $.CurrentSection.Params.Code )}} {{ $posts := (where $.Site.RegularPages "CurrentSection.Params.Code" "==" $.CurrentSection.Params.Code )}}
@ -19,17 +19,6 @@
</aside> </aside>
{{ end }} {{ end }}
<section class="column is-7"> <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> <div>
<article> <article>
{{ .Content }} {{ .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 }}