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: theme:
- chosto - chosto
menu:
main:
- identifier: categories
name: Catégories
url: /categories/

View File

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

View File

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

View File

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

View File

@ -5,6 +5,13 @@
{{ with .Params.subtitle }} {{ with .Params.subtitle }}
<p class="subtitle">{{ . }}</p> <p class="subtitle">{{ . }}</p>
{{ end }} {{ 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> </div>
</section> </section>
</header> </header>

View File

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

View File

@ -12,11 +12,24 @@
<div id="navbar" class="navbar-menu"> <div id="navbar" class="navbar-menu">
<div class="navbar-start"> <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> <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 := . }} {{ $currentPage := . }}
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
{{ if .HasChildren }} {{ if .HasChildren }}
<div class="navbar-item has-dropdown is-hoverable {{ if $currentPage.HasMenuCurrent "main" . }}is-active is-tab{{ end }}"> <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 }} {{ .Pre }}
<span>{{ .Name }}</span> <span>{{ .Name }}</span>
</a> </a>
@ -31,7 +44,9 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>
<div class="navbar-end"><!-- See later to differentiate --></div> <div class="navbar-end">
<!-- See later to differentiate -->
</div>
</div> </div>
</div> </div>
</nav> </nav>

View File

@ -1,60 +1,59 @@
{{ define "main" }} {{ define "main" }}
<div class="container"> <div class="columns mt-5 is-variable is-6">
<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>
<!-- <!--
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.Params.Title }}
<aside class="menu"> <aside class="menu box column is-3">
<p class="menu-label"> <p class="menu-label">
Dans le dossier « {{ . }} »... Dans le dossier « {{ . }} »...
</p> </p>
<ul 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 )}}
{{ $postsSorted := (sort $posts "Date" )}} {{ $postsSorted := (sort $posts "Date" )}}
{{ range $postsSorted }} {{ range $postsSorted }}
<li><a <a {{ if eq $.Title .Title }} class="is-active" {{ end }} href="{{ .Permalink }}">{{ .Title }}</a>
{{ if eq $.Title .Title }}
class="is-active"
{{ end }} {{ end }}
href="{{ .Permalink }}">{{ .Title }}</a></li> </div>
{{ end }}
</ul>
</aside> </aside>
{{ end }} {{ end }}
<section class="column is-7">
<aside>
<div>
<section> <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 }}
</article> </article>
</div> </div>
</section> <aside class="container level my-5">
<aside> <div class="level-left">
<div>
{{ with .PrevInSection }} {{ 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 }} {{ end }}
</div>
<div class="level-right">
{{ with .NextInSection }} {{ 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 }} {{ end }}
</div> </div>
</aside> </aside>
</section>
<aside class="column is-3">
{{- partial "about.html" . -}}
</aside>
</div> </div>
{{ end }} {{ end }}

View File

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

View File

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