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>
<body class="has-navbar-fixed-top">
<div class="content">
{{- partial "navbar.html" . -}}
{{- partial "header.html" . -}}
<div class="content">
<div class="container">
{{- block "main" . }}{{- end }}
</div>
{{- partial "about.html" . -}}
</div>
{{- partial "footer.html" . -}}
</div>
</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>
<section class="hero is-primary is-medium">
<div class="hero-body has-text-centered">
<p class="title">{{ .Title }}</p>
{{ with .Params.subtitle }}
<h2>{{ . }}</h2>
<p class="subtitle">{{ . }}</p>
{{ end }}
</div>
</section>
</header>

View File

@ -1,29 +1,37 @@
<nav class="menu">
<ul>
<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="#">
<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>
</li>
<ul class="sub-menu">
<div class="navbar-dropdown">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
<a class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
</ul>
</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>
</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,4 +1,5 @@
{{ define "main" }}
<div class="container">
<aside>
<div>
<section>
@ -39,7 +40,6 @@ with all other blog posts belonging to that case, emphasis to the current.
</aside>
{{ end }}
<section>
<h1>{{ .Title }}</h1>
<div>
<article>
{{ .Content }}
@ -56,4 +56,5 @@ with all other blog posts belonging to that case, emphasis to the current.
{{ 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 }}