Add root pages, better footer and case header, automatic start/end navbar
parent
0d608492ad
commit
a296d8e5b8
|
@ -4,13 +4,13 @@ My blog built with Hugo (static website generator) and Bulma (tiny yet powerful
|
||||||
|
|
||||||
## Content and choices
|
## Content and choices
|
||||||
|
|
||||||
It contains a theme coded specifically for the blog, with example taken from Hugo documentation. The purpose of not taking a great existing theme is to learn new webthings (because I really suck at web development). Also I wanted to learn a bit about Bulma, a tiny CSS framework without a line of JavaScript.
|
It contains a theme coded specifically for the blog, with examples taken from Hugo documentation. The purpose of not taking a great existing theme is to learn new webthings (because I really suck at web development). Also I wanted to learn a bit about Bulma, a tiny CSS framework without a line of JavaScript.
|
||||||
|
|
||||||
Hugo is really powerful yet pretty light and really fast. I do like the way templating is used to achieve very elegant tricks. In the past we would have used databases and dynamic languages like PHP for the same result.
|
Hugo is really powerful yet pretty light and really fast. I do like the way templating is used to achieve very elegant tricks. In the past we would have used databases and dynamic languages like PHP for the same result.
|
||||||
|
|
||||||
I think that using Wordpress for a little static blog is no longer relevant and I am really enthousiastic about projects like Hugo. Additionnally, the community seems very friendly. Other static CMS such as Ghost have an economic model that I don't like (eg you have to pay for plugins) and Grav is great but not so artisanal. The learning curve is pretty high and you're encouraged to use an existing theme with the PHP admin interface.
|
I think that using Wordpress for a little static blog is no longer relevant and I am really enthousiastic about projects like Hugo. Additionnally, the community seems very friendly. Other static CMS such as Ghost have an economic model that I don't like (eg you have to pay for plugins) and Grav is great but not so artisanal. The learning curve is pretty high and you're encouraged to use an existing theme with the PHP admin interface.
|
||||||
|
|
||||||
With Hugo, I really have the sensation of minimizing the ressources I use while totally understanding what I am doing (even if I am doing it badly). Only exception would be the pagination which uses an obscure internal template for ease.
|
With Hugo, I really have the sensation of minimizing the ressources I use while totally understanding what I am doing (even if I am doing it badly).
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
|
@ -19,3 +19,7 @@ Just run `hugo` and serve the `public` directory.
|
||||||
Remember to delete existing `public` directory before rebuilding blog.
|
Remember to delete existing `public` directory before rebuilding blog.
|
||||||
|
|
||||||
For development, run `hugo server --watch` to watch for config/content changes, rebuild site and serve it on localhost.
|
For development, run `hugo server --watch` to watch for config/content changes, rebuild site and serve it on localhost.
|
||||||
|
|
||||||
|
## Using the theme
|
||||||
|
|
||||||
|
TODO 😄
|
||||||
|
|
|
@ -10,9 +10,11 @@ watch: true
|
||||||
paginate: 5
|
paginate: 5
|
||||||
summaryLength: 50
|
summaryLength: 50
|
||||||
|
|
||||||
# All pages under posts section will have this link structure
|
|
||||||
permalinks:
|
permalinks:
|
||||||
|
# All pages under posts section will have this link structure
|
||||||
posts: /:sections/:title/
|
posts: /:sections/:title/
|
||||||
|
# For root section, just use title
|
||||||
|
/: :title
|
||||||
|
|
||||||
# Disable all privacy unfriendly stuff
|
# Disable all privacy unfriendly stuff
|
||||||
privacy:
|
privacy:
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: À propos
|
||||||
|
menu: end
|
||||||
|
---
|
|
@ -1,8 +1,10 @@
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<main>
|
<main>
|
||||||
{{ with .Content }}
|
{{ with .Content }}
|
||||||
<article>
|
<article class="message mt-5 mb-2 is-medium">
|
||||||
|
<div class="message-body">
|
||||||
{{ . }}
|
{{ . }}
|
||||||
|
</div>
|
||||||
</article>
|
</article>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="columns is-multiline is-mobile">
|
<div class="columns is-multiline is-mobile">
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class="columns mt-5 is-variable is-mobile is-8">
|
<div class="columns mt-5 is-variable is-mobile is-8">
|
||||||
<!--
|
<!--
|
||||||
If the current blog post belongs to a case, we will add a side menu
|
If the current page is a blog post and 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.
|
||||||
-->
|
-->
|
||||||
|
{{ if (and .IsPage (eq .FirstSection "posts"))}}
|
||||||
{{ with .CurrentSection }}
|
{{ with .CurrentSection }}
|
||||||
<aside class="menu box column is-3 is-align-self-flex-start is-fixed-top" style="position: sticky; top: 10%;">
|
<aside class="menu box column is-3 is-align-self-flex-start is-fixed-top" style="position: sticky; top: 10%;">
|
||||||
<p class="menu-label">
|
<p class="menu-label">
|
||||||
|
@ -18,6 +19,7 @@
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
<section class="column is-8">
|
<section class="column is-8">
|
||||||
<div>
|
<div>
|
||||||
<article>
|
<article>
|
||||||
|
@ -41,8 +43,10 @@
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
</section>
|
</section>
|
||||||
|
{{ if (and .IsPage (eq .FirstSection "posts"))}}
|
||||||
<aside class="box column is-2 is-align-self-flex-start" style="position: sticky; top: 10%;">
|
<aside class="box column is-2 is-align-self-flex-start" style="position: sticky; top: 10%;">
|
||||||
{{- partial "about.html" . -}}
|
{{- partial "about.html" . -}}
|
||||||
</aside>
|
</aside>
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
|
@ -1,15 +1,9 @@
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="level">
|
<div class="has-text-centered">
|
||||||
<div class="level-left">
|
|
||||||
<div class="level-item">
|
|
||||||
Conçu avec <a href="https://gohugo.io/">Hugo</a> et <a href="https://bulma.io">Bulma</a>.
|
Conçu avec <a href="https://gohugo.io/">Hugo</a> et <a href="https://bulma.io">Bulma</a>.
|
||||||
</div>
|
Les sources sont disponibles <a href="https://git.chosto.me/Chosto/blog">ici</a>.
|
||||||
<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 <a href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution ShareAlike 4.0.</a>
|
Tout le contenu du blog est disponible sous licence <a href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution ShareAlike 4.0.</a>
|
||||||
</div>
|
<br /><br />
|
||||||
|
Prenez soin de vous. ❤️
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<header>
|
<header>
|
||||||
<section class="hero is-primary is-medium">
|
<section class="hero is-primary is-medium">
|
||||||
<div class="hero-body has-text-centered">
|
<div class="hero-body has-text-centered">
|
||||||
<p class="title">{{ .Title }}</p>
|
<p class="title is-1 is-uppercase">{{ .Title }}</p>
|
||||||
{{ with .Params.subtitle }}
|
{{ with .Params.subtitle }}
|
||||||
<p class="subtitle">{{ . }}</p>
|
<p class="subtitle is-2">{{ . }}</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ with .Params.categories }}
|
{{ with .Params.categories }}
|
||||||
<div class="tags colums is-centered is-rounded">
|
<div class="tags colums is-centered is-rounded">
|
||||||
|
@ -12,7 +12,8 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .IsPage }}
|
<!-- Words and date stuff makes sens only for blog posts, not other pages -->
|
||||||
|
{{ if (and .IsPage (eq .FirstSection "posts"))}}
|
||||||
<aside>
|
<aside>
|
||||||
<div>
|
<div>
|
||||||
<section>
|
<section>
|
||||||
|
|
|
@ -8,9 +8,10 @@
|
||||||
<span aria-hidden="true"></span>
|
<span aria-hidden="true"></span>
|
||||||
<span aria-hidden="true"></span>
|
<span aria-hidden="true"></span>
|
||||||
</a>
|
</a>
|
||||||
|
</div>
|
||||||
<div id="navbar" class="navbar-menu">
|
<div id="navbar" class="navbar-menu">
|
||||||
<div class="navbar-start">
|
<!-- In case of another navbar-start right after -->
|
||||||
|
<div class="navbar-start mr-0">
|
||||||
<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">
|
<div class="navbar-item has-dropdown is-hoverable">
|
||||||
<a class="navbar-link">
|
<a class="navbar-link">
|
||||||
|
@ -39,28 +40,34 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- start/end menu shares the exact same code, just not the same position, factorize with a loop -->
|
||||||
{{ $currentPage := . }}
|
{{ $currentPage := . }}
|
||||||
{{ range .Site.Menus.main }}
|
{{ range (slice "start" "end")}}
|
||||||
|
{{ $menu_name := . }}
|
||||||
|
<div class="navbar-{{ . }} mr-2">
|
||||||
|
<!-- now get the menu if it exists -->
|
||||||
|
{{ with index $.Site.Menus $menu_name }}
|
||||||
|
<!-- and range over its pages -->
|
||||||
|
{{ range . }}
|
||||||
{{ 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 $menu_name . }}is-active is-tab{{ end }}">
|
||||||
<a class="navbar-link">
|
<a class="navbar-link">
|
||||||
{{ .Pre }}
|
{{ .Pre }}
|
||||||
<span>{{ .Name }}</span>
|
<span>{{ .Name }}</span>
|
||||||
</a>
|
</a>
|
||||||
<div class="navbar-dropdown">
|
<div class="navbar-dropdown">
|
||||||
{{ range .Children }}
|
{{ range .Children }}
|
||||||
<a class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
|
<a class="navbar-item {{ if $currentPage.IsMenuCurrent $menu_name . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<a class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
|
<a class="navbar-item {{ if $currentPage.IsMenuCurrent $menu_name . }}is-active is-tab{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-end">
|
{{ end }}
|
||||||
<!-- See later to differentiate -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{{ $pag := $.Paginator }}
|
{{ $pag := $.Paginator }}
|
||||||
{{ if gt $pag.TotalPages 1 -}}
|
{{ if gt $pag.TotalPages 1 -}}
|
||||||
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
|
<nav class="my-5 pagination is-centered" role="navigation" aria-label="pagination">
|
||||||
{{ with $pag.First -}}
|
{{ with $pag.First -}}
|
||||||
<ul class="pagination-list">
|
<ul class="pagination-list">
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if $showNumber }}
|
{{- if $showNumber }}
|
||||||
<li>
|
<li>
|
||||||
<a class="pagination-link{{ if eq . $pag }} is-current{{ end }}" href="{{ .URL }}" aria-label="Page {{ .PageNumber }}">{{ .PageNumber }}</a>
|
<a class="mx-1 pagination-link{{ if eq . $pag }} is-current{{ end }}" href="{{ .URL }}" aria-label="Page {{ .PageNumber }}">{{ .PageNumber }}</a>
|
||||||
</li>
|
</li>
|
||||||
{{- else if $shouldEllipse }}
|
{{- else if $shouldEllipse }}
|
||||||
<li>
|
<li>
|
||||||
|
|
Loading…
Reference in New Issue