Start to add some style and navbar

master
Quentin Duchemin 2021-05-21 14:53:35 +02:00
parent 6a520b937e
commit 37834a6df6
Signed by: Chosto
GPG Key ID: 0547178FEEDE7D6B
12 changed files with 168 additions and 94 deletions

View File

@ -1,5 +1,4 @@
---
title: Billets à la mer
subtitle: Pensées d'un ingénieur qui voulait être vivant
menu: main
---

View File

@ -1,13 +1,15 @@
<!DOCTYPE html>
<html>
{{- partial "head.html" . -}}
<body>
{{- partial "navbar.html" . -}}
{{- partial "header.html" . -}}
<body class="has-navbar-fixed-top">
<div class="content">
{{- block "main" . }}{{- end }}
{{- partial "navbar.html" . -}}
{{- partial "header.html" . -}}
<div class="container">
{{- block "main" . }}{{- end }}
{{- partial "about.html" . -}}
</div>
{{- partial "footer.html" . -}}
</div>
{{- partial "about.html" . -}}
{{- partial "footer.html" . -}}
</body>
</html>

View File

@ -8,7 +8,7 @@
{{ range .Paginator.Pages }}
{{ .Render "summary" }}
{{ end }}
{{ template "_internal/pagination.html" . }}
{{- partial "pagination.html" . -}}
</div>
</main>
{{ end }}

View File

@ -1,3 +1,15 @@
<footer>
Quentin Duchemin
<footer class="footer">
<div class="level">
<div class="level-left">
<div class="level-item">
Conçu avec&nbsp;<a href="https://gohugo.io/">Hugo</a>&nbsp;et&nbsp;<a href="https://bulma.io">Bulma</a>.
</div>
<div class="level-item">
<a href="https://git.chosto.me/Chosto/blog">Sources du blog</a>.
</div>
</div>
<div class="level-right">
Tout le contenu du blog est disponible sous licence&nbsp;<a href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0.</a>
</div>
</div>
</footer>

View File

@ -1,6 +1,10 @@
<header>
<h1>{{ .Title }}</h1>
{{ with .Params.subtitle }}
<h2>{{ . }}</h2>
{{ end }}
<section class="hero is-primary is-medium">
<div class="hero-body has-text-centered">
<p class="title">{{ .Title }}</p>
{{ with .Params.subtitle }}
<p class="subtitle">{{ . }}</p>
{{ end }}
</div>
</section>
</header>

View File

@ -1,29 +1,37 @@
<nav class="menu">
<ul>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<nav class="navbar is-fixed-top is-transparent" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="{{ .Site.Home.Permalink }}">
<img src="https://bulma.io/images/placeholders/128x128.png">
</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbar">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
<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>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<a href="#">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
<ul class="sub-menu">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
<div class="navbar-item has-dropdown is-hoverable {{ if $currentPage.HasMenuCurrent "main" . }}is-active is-tab{{ end }}">
<a href="#" class="navbar-link">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
<div class="navbar-dropdown">
{{ range .Children }}
<a class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
</div>
</div>
{{ else }}
<li>
<a href="{{ .URL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
<a class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
{{ end }}
</ul>
{{ end }}
</div>
<div class="navbar-end"><!-- See later to differentiate --></div>
</div>
</div>
</nav>

View File

@ -0,0 +1,45 @@
{{ $pag := $.Paginator }}
{{ if gt $pag.TotalPages 1 -}}
<ul class="pagination">
{{ with $pag.First -}}
<li class="page-item">
<a href="{{ .URL }}" class="page-link" aria-label="First"><span aria-hidden="true">&laquo;&laquo;</span></a>
</li>
{{ end -}}
<li class="page-item{{ if not $pag.HasPrev }} disabled{{ end }}">
<a {{ if $pag.HasPrev }}href="{{ $pag.Prev.URL }}"{{ end }} class="page-link" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
</li>
{{- $ellipsed := false -}}
{{- $shouldEllipse := false -}}
{{- range $pag.Pagers -}}
{{- $right := sub .TotalPages .PageNumber -}}
{{- $showNumber := or (le .PageNumber 3) (eq $right 0) -}}
{{- $showNumber := or $showNumber (le .TotalPages 5) -}}{{/* Issue #7523 */}}
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) -}}
{{- if $showNumber -}}
{{- $ellipsed = false -}}
{{- $shouldEllipse = false -}}
{{- else -}}
{{- $shouldEllipse = not $ellipsed -}}
{{- $ellipsed = true -}}
{{- end -}}
{{- if $showNumber }}
<li class="page-item{{ if eq . $pag }} active{{ end }}">
<a class="page-link" href="{{ .URL }}">{{ .PageNumber }}</a>
</li>
{{- else if $shouldEllipse }}
<li class="page-item disabled">
<span aria-hidden="true">&nbsp;&hellip;&nbsp;</span>
</li>
{{- end -}}
{{- end }}
<li class="page-item{{ if not $pag.HasNext }} disabled{{ end }}">
<a {{ if $pag.HasNext }}href="{{ $pag.Next.URL }}"{{ end }} class="page-link" aria-label="Next"><span aria-hidden="true">&raquo;</span></a>
</li>
{{- with $pag.Last }}
<li class="page-item">
<a href="{{ .URL }}" class="page-link" aria-label="Last"><span aria-hidden="true">&raquo;&raquo;</span></a>
</li>
{{- end }}
</ul>
{{ end }}

View File

@ -7,8 +7,9 @@
<ul>
<!-- Ranges through content/posts/*.md -->
{{ range .Site.RegularPages }}
{{- partial "list.html" . -}}
{{- partial "listitem.html" . -}}
{{ end }}
</ul>
{{- partial "pagination.html" . -}}
</main>
{{ end }}

View File

@ -1,59 +1,60 @@
{{ define "main" }}
<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>
<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>
<!--
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">
<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>
{{ 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">
<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>
<h1>{{ .Title }}</h1>
<div>
<article>
{{ .Content }}
</article>
</div>
</section>
<aside>
</aside>
{{ end }}
<section>
<div>
{{ with .PrevInSection }}
<a class="previous" href="{{ .Permalink }}"> {{ .Title }}</a>
{{ end }}
{{ with .NextInSection }}
<a class="next" href="{{ .Permalink }}"> {{ .Title }}</a>
{{ end }}
<article>
{{ .Content }}
</article>
</div>
</aside>
</section>
<aside>
<div>
{{ with .PrevInSection }}
<a class="previous" href="{{ .Permalink }}"> {{ .Title }}</a>
{{ end }}
{{ with .NextInSection }}
<a class="next" href="{{ .Permalink }}"> {{ .Title }}</a>
{{ end }}
</div>
</aside>
</div>
{{ end }}

View File

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

View File

@ -7,8 +7,9 @@
<ul>
<!-- Ranges through the term pages -->
{{ range .Pages }}
{{- partial "list.html" . -}}
{{- partial "listitem.html" . -}}
{{ end }}
</ul>
{{- partial "pagination.html" . -}}
</main>
{{ end }}