Rework menu categories

master
Quentin Duchemin 2021-05-21 23:50:10 +02:00
parent 9c486c8331
commit 526ba6d991
Signed by: Chosto
GPG Key ID: 0547178FEEDE7D6B
10 changed files with 74 additions and 62 deletions

View File

@ -31,9 +31,3 @@ privacy:
theme:
- chosto
menu:
main:
- identifier: categories
name: Catégories
url: /categories/

View File

@ -7,7 +7,6 @@
{{- partial "header.html" . -}}
<div class="container">
{{- block "main" . }}{{- end }}
{{- partial "about.html" . -}}
</div>
{{- partial "footer.html" . -}}
</div>

View File

@ -1,4 +1,4 @@
<article class="post">
<article class="block">
<header>
<h2><a href='{{ .Permalink }}'> {{ .Title }}</a> </h2>
<div class="post-meta">

View File

@ -1,14 +1,13 @@
{{ define "main" }}
<main>
{{ with .Content }}
<div>
<!-- Note that the content for index.html, as a sort of list page, will pull from content/_index.md -->
{{ .Content }}
{{ . }}
</div>
<div>
{{ end }}
{{ range .Paginator.Pages }}
{{ .Render "summary" }}
{{ end }}
{{- partial "pagination.html" . -}}
</div>
</main>
{{ end }}

View File

@ -5,6 +5,13 @@
{{ with .Params.subtitle }}
<p class="subtitle">{{ . }}</p>
{{ end }}
{{ with .Params.categories }}
<div class="tags colums is-centered is-rounded">
{{ range . }}
<span class="tag is-large mx-2"><a href="{{ "categories" | absURL }}/{{ . | urlize }}">{{ . }}</a></span>
{{ end }}
</div>
{{ end }}
</div>
</section>
</header>

View File

@ -1,4 +1,4 @@
<li>
<div class="block">
<a href="{{.Permalink}}">
<time class="post-date" datetime="{{ .Date.Format `2006-01-02T15:04:05Z07:00` | safeHTML }}">
{{ .Date.Day }} {{ index $.Site.Data.months_fr (printf "%d" .Date.Month) }} {{ .Date.Year }}
@ -28,4 +28,4 @@
{{ end }}
{{ .Title }}
</a>
</li>
</div>

View File

@ -12,11 +12,24 @@
<div id="navbar" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item {{ if eq .Permalink .Site.Home.Permalink }}is-active is-tab{{ end }}" href="{{ .Site.Home.Permalink }}">Accueil</a>
<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" href="{{ .Page.Permalink }}">
{{ $key | humanize }}
<span class="tag ml-2 is-rounded">{{ len . }}</span>
</a>
{{ end }}
</div>
</div>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<div class="navbar-item has-dropdown is-hoverable {{ if $currentPage.HasMenuCurrent "main" . }}is-active is-tab{{ end }}">
<a href="#" class="navbar-link">
<a class="navbar-link">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
@ -31,7 +44,9 @@
{{ end }}
{{ end }}
</div>
<div class="navbar-end"><!-- See later to differentiate --></div>
<div class="navbar-end">
<!-- See later to differentiate -->
</div>
</div>
</div>
</nav>

View File

@ -1,60 +1,59 @@
{{ define "main" }}
<div class="container">
<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>
{{ with .Params.categories }}
<ul>
{{ range . }}
<li><a href="{{ "categories" | absURL }}/{{ . | urlize }}">{{ . }}</a> </li>
{{ end }}
</ul>
{{ end }}
</div>
</aside>
<div class="columns mt-5 is-variable is-6">
<!--
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">
<aside class="menu box column is-3">
<p class="menu-label">
Dans le dossier « {{ . }} »...
</p>
<ul class="menu-list">
<div 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"
<a {{ if eq $.Title .Title }} class="is-active" {{ end }} href="{{ .Permalink }}">{{ .Title }}</a>
{{ end }}
href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</div>
</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 }}
</article>
</div>
</section>
<aside>
<div>
<aside class="container level my-5">
<div class="level-left">
{{ with .PrevInSection }}
<a class="previous" href="{{ .Permalink }}"> {{ .Title }}</a>
<div class="level-item">
<a class="button is-info" href="{{ .Permalink }}">&laquo;&laquo;&nbsp;{{ .Title }}</a>
</div>
{{ end }}
</div>
<div class="level-right">
{{ with .NextInSection }}
<a class="next" href="{{ .Permalink }}"> {{ .Title }}</a>
<div class="level-item">
<a class="button is-info" href="{{ .Permalink }}">{{ .Title }}&nbsp;&raquo;&raquo;</a>
</div>
{{ end }}
</div>
</aside>
</section>
<aside class="column is-3">
{{- partial "about.html" . -}}
</aside>
</div>
{{ end }}

View File

@ -5,6 +5,5 @@
<li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li>
{{ end }}
</ul>
{{- partial "pagination.html" . -}}
</main>
{{ end }}

View File

@ -6,7 +6,7 @@
</article>
<ul>
<!-- Ranges through the term pages -->
{{ range .Pages }}
{{ range .Paginator.Pages }}
{{- partial "listitem.html" . -}}
{{ end }}
</ul>