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 title: Billets à la mer
subtitle: Pensées d'un ingénieur qui voulait être vivant subtitle: Pensées d'un ingénieur qui voulait être vivant
menu: main
--- ---

View File

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

View File

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

View File

@ -1,3 +1,15 @@
<footer> <footer class="footer">
Quentin Duchemin <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> </footer>

View File

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

View File

@ -1,29 +1,37 @@
<nav class="menu"> <nav class="navbar is-fixed-top is-transparent" role="navigation" aria-label="main navigation">
<ul> <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 := . }} {{ $currentPage := . }}
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
{{ if .HasChildren }} {{ if .HasChildren }}
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}"> <div class="navbar-item has-dropdown is-hoverable {{ if $currentPage.HasMenuCurrent "main" . }}is-active is-tab{{ end }}">
<a href="#"> <a href="#" class="navbar-link">
{{ .Pre }} {{ .Pre }}
<span>{{ .Name }}</span> <span>{{ .Name }}</span>
</a> </a>
</li> <div class="navbar-dropdown">
<ul class="sub-menu">
{{ range .Children }} {{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}"> <a class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }} {{ end }}
</ul> </div>
</div>
{{ else }} {{ else }}
<li> <a class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
<a href="{{ .URL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{ end }} {{ end }}
{{ end }} {{ end }}
</ul> </div>
<div class="navbar-end"><!-- See later to differentiate --></div>
</div>
</div>
</nav> </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> <ul>
<!-- Ranges through content/posts/*.md --> <!-- Ranges through content/posts/*.md -->
{{ range .Site.RegularPages }} {{ range .Site.RegularPages }}
{{- partial "list.html" . -}} {{- partial "listitem.html" . -}}
{{ end }} {{ end }}
</ul> </ul>
{{- partial "pagination.html" . -}}
</main> </main>
{{ end }} {{ end }}

View File

@ -1,4 +1,5 @@
{{ define "main" }} {{ define "main" }}
<div class="container">
<aside> <aside>
<div> <div>
<section> <section>
@ -39,7 +40,6 @@ with all other blog posts belonging to that case, emphasis to the current.
</aside> </aside>
{{ end }} {{ end }}
<section> <section>
<h1>{{ .Title }}</h1>
<div> <div>
<article> <article>
{{ .Content }} {{ .Content }}
@ -56,4 +56,5 @@ with all other blog posts belonging to that case, emphasis to the current.
{{ end }} {{ end }}
</div> </div>
</aside> </aside>
</div>
{{ end }} {{ end }}

View File

@ -5,5 +5,6 @@
<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

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