Compare commits

..

No commits in common. "2c37e1e0e95b00605bbe0d1b8257f151eb925003" and "e80cac8c43d9ddd6f49e2617ca9d3586fd790ca8" have entirely different histories.

11 changed files with 45 additions and 64 deletions

View File

@ -4,4 +4,4 @@ subtitle:
code: code:
draft: true draft: true
--- ---
{{/* We use sections to define "cases", i.e. serie of articles about a topic */}} <!-- We use sections to define "cases", i.e. serie of articles about a topic -->

View File

@ -1,2 +1,2 @@
{{/* Overwrite default title rendering to add anchor */}} <!-- Overwrite default title rendering to add anchor -->
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} <a href="#{{ .Anchor | safeURL }}"></a></h{{ .Level }}> <h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} <a href="#{{ .Anchor | safeURL }}"></a></h{{ .Level }}>

View File

@ -1,23 +1,20 @@
{{ define "main" }} {{ define "main" }}
{{/* Default list used for homepage and taxonomy pages (e.g. tags), <!-- Default list used for homepage and taxonomy pages (e.g. tags),
but not for sections (see section.html template) */}} but not for sections (see section.html template) -->
<div class="section pt-5"> <div class="section pt-5">
<div class="container is-max-widescreen"> <div class="container is-max-widescreen">
<main> <main>
<div class="columns is-multiline"> <div class="columns is-multiline">
{{/* Custom paginator with only blog posts (e.g. avoid "À propos") which <!-- Custom paginator with only blog posts (e.g. avoid "À propos"),
are already written (avoid "incoming" posts of thematic series), ordered from newest to oldest -->
ordered from newest to oldest */}} {{ $paginator := .Paginator }}
{{ $paginator := .Paginate
(where
(where site.RegularPages ".Type" "in" site.Params.mainSections)
".Params.incoming" "!=" true)
}}
{{ range $paginator.Pages }} {{ range $paginator.Pages }}
{{ if (eq .FirstSection.Section "posts")}}
<div class="column is-variable is-one-third"> <div class="column is-variable is-one-third">
{{ .Render "summary" }} {{ .Render "summary" }}
</div> </div>
{{ end }} {{ end }}
{{ end }}
</div> </div>
{{- partial "pagination.html" $paginator -}} {{- partial "pagination.html" $paginator -}}
</main> </main>

View File

@ -2,7 +2,7 @@
<div class="section"> <div class="section">
<div class="container is-max-widescreen"> <div class="container is-max-widescreen">
<main> <main>
{{/* A section _index.md may have a content, describing its theme */}} <!-- A section _index.md may have a content, describing its theme -->
{{ with .Content }} {{ with .Content }}
<article class="message mt-5 mb-2"> <article class="message mt-5 mb-2">
<div class="message-body content"> <div class="message-body content">
@ -10,9 +10,9 @@
</div> </div>
</article> </article>
{{ end }} {{ end }}
{{/* Then simply show posts belonging to the section, <!-- Then simply show posts belonging to the section,
but contrary to index and taxonomy, show oldest to newest, but contrary to index and taxonomy, show oldest to newest,
to keep a sense of progression */}} to keep a sense of progression -->
<div class="columns is-multiline"> <div class="columns is-multiline">
{{ $paginator := .Paginate .RegularPagesRecursive.ByDate }} {{ $paginator := .Paginate .RegularPagesRecursive.ByDate }}
{{ range $paginator.Pages }} {{ range $paginator.Pages }}

View File

@ -1,15 +1,15 @@
{{ define "main" }} {{ define "main" }}
<div class="section"> <div class="section">
{{/* <!--
If the current page is a blog post and belongs to a thematic serie, add a side menu If the current page is a blog post and belongs to a thematic serie, 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.
Still use empty container if nothing to show for homogeneous layout Still use empty container if nothing to show for homogeneous layout
*/}} -->
{{/* is-desktop stacks vertically columns for tablets and mobiles. is-8 is a <!-- is-desktop stacks vertically columns for tablets and mobiles. is-8 is a
maximum gap of 2rem between columns */}} maximum gap of 2rem between columns -->
<div class="columns is-variable is-desktop is-8"> <div class="columns is-variable is-desktop is-8">
{{/* To ease reading, the content is a bit wider for small screens <!-- To ease reading, the content is a bit wider for small screens
but not too wide for big screens */}} but not too wide for big screens -->
<aside class="menu column mt-2 is-one-fifth-desktop is-one-fifth-fullhd is-full-tablet is-full-mobile"> <aside class="menu column mt-2 is-one-fifth-desktop is-one-fifth-fullhd is-full-tablet is-full-mobile">
{{ if (and .IsPage (eq .FirstSection.Section "posts"))}} {{ if (and .IsPage (eq .FirstSection.Section "posts"))}}
{{ with .CurrentSection }} {{ with .CurrentSection }}
@ -18,21 +18,11 @@
<a href="{{ .Permalink }}">{{ .Params.Title }}</a> <a href="{{ .Permalink }}">{{ .Params.Title }}</a>
</p> </p>
<div class="menu-list"> <div class="menu-list">
{{/* Get all posts belonging to the current thematic serie, sorted by date */}}
{{ $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 }}
{{/* Show titles for incoming posts, but do not make them clickable. Note
that they will still be accessible by crafting the URL by hand. This
is **not** a security, just a nice way to tease stuff. To really hide
something it should be marked as "draft: true" so the page is not built. */}}
{{ if eq .Params.incoming true }}
<a class="disabled">{{ .Title }} <i class="has-text-grey">(à venir)</i></a>
{{ else }}
{{/* Otherwise link to the posts, highlightning the current one */}}
<a {{ if eq $.Title .Title }} class="is-active" {{ end }} href="{{ .Permalink }}">{{ .Title }}</a> <a {{ if eq $.Title .Title }} class="is-active" {{ end }} href="{{ .Permalink }}">{{ .Title }}</a>
{{ end }} {{ end }}
{{ end }}
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}
@ -41,7 +31,7 @@
<section class="column content is-three-fifths-desktop is-three-fifths-fullhd is-full-tablet is-full-mobile"> <section class="column content is-three-fifths-desktop is-three-fifths-fullhd is-full-tablet is-full-mobile">
<div> <div>
<article> <article>
{{/* If this is part of a thematic serie, remind it so it is clear */}} <!-- If this is part of a thematic serie, remind it so it is clear -->
{{ if (and .IsPage (eq .FirstSection.Section "posts"))}} {{ if (and .IsPage (eq .FirstSection.Section "posts"))}}
{{ with .CurrentSection }} {{ with .CurrentSection }}
{{ if .Params.Title }} {{ if .Params.Title }}
@ -54,7 +44,7 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{/* First thing is a legend for the hero image, if it exists */}} <!-- First thing is a legend for the hero image, if it exists -->
{{ with .Params.imgExplanation }} {{ with .Params.imgExplanation }}
<div class="message"> <div class="message">
<div class="message-body content is-italic"> <div class="message-body content is-italic">
@ -62,7 +52,7 @@
</div> </div>
</div> </div>
{{ end }} {{ end }}
{{/* Second, an introductive message before ToC, if it exists */}} <!-- Second, an introductive message before ToC, if it exists -->
{{ with .Params.intro | markdownify | safeHTML }} {{ with .Params.intro | markdownify | safeHTML }}
<div class="message is-dark"> <div class="message is-dark">
<div class="message-body"> <div class="message-body">
@ -70,16 +60,16 @@
</div> </div>
</div> </div>
{{ end }} {{ end }}
{{/* Then, ToC if text has more than 600 words and not explicitly asked not to */}} <!-- Then, ToC if text has more than 600 words and not explicitly asked not to -->
{{ if (and (not .Params.notoc) (gt .WordCount 600)) }} {{ if (and (not .Params.notoc) (gt .WordCount 600)) }}
<div class="message is-link"> <div class="message is-link">
<div class="message-header">Sommaire</div> <div class="message-header">Sommaire</div>
{{/* Appreciate this horrible trick, even a 2000's HTML generator won't generate such code */}} <!-- Appreciate this horrible trick, even a 2000's HTML generator won't generate such code -->
<div class="message-body has-text-left pt-1"> <div class="message-body has-text-left pt-1">
{{ .TableOfContents | replaceRE "<a" "<a style='text-decoration:none;'" | safeHTML }}</div> {{ .TableOfContents | replaceRE "<a" "<a style='text-decoration:none;'" | safeHTML }}</div>
</div> </div>
{{ end }} {{ end }}
{{/* Finally, content! */}} <!-- Finally, content! -->
{{ .Content }} {{ .Content }}
</article> </article>
</div> </div>

View File

@ -12,7 +12,7 @@
<div class="card-content" style="height:100%;"> <div class="card-content" style="height:100%;">
<div class="has-text-centered"> <div class="has-text-centered">
<a class="title is-4" href="{{.Permalink}}"> <a class="title is-4" href="{{.Permalink}}">
{{/* <!--
Well, I am a beginner with Hugo so this is probably like crushing a banana with a rocket. Well, I am a beginner with Hugo so this is probably like crushing a banana with a rocket.
When a post belongs to a "case" (i.e. a section with a code, I'd like to have [INDEX/TOTAL] printed in title. When a post belongs to a "case" (i.e. a section with a code, I'd like to have [INDEX/TOTAL] printed in title.
An when a post is on its own, don't print anything. An when a post is on its own, don't print anything.
@ -20,7 +20,7 @@
But I don't wan't to write it manually because it could break when adding a blog post in between two existing blog posts. But I don't wan't to write it manually because it could break when adding a blog post in between two existing blog posts.
So, iterate over the blog posts with same section as current blog post, order them by date and save the index of current blog post. So, iterate over the blog posts with same section as current blog post, order them by date and save the index of current blog post.
Maybe there is an easier way to get the same result... Maybe there is an easier way to get the same result...
*/}} -->
{{ $currentPost := . }} {{ $currentPost := . }}
{{ $currentPostIndex := 1 }} {{ $currentPostIndex := 1 }}
{{ $posts := (where $.Site.RegularPages "CurrentSection.Params.Code" "==" $.CurrentSection.Params.Code )}} {{ $posts := (where $.Site.RegularPages "CurrentSection.Params.Code" "==" $.CurrentSection.Params.Code )}}
@ -37,8 +37,8 @@
</a> </a>
</div> </div>
<hr style="margin: 1rem 0;"> <hr style="margin: 1rem 0;">
{{/* If a special summary (before ToC) have been defined, <!-- If a special summary (before ToC) have been defined,
prefer using it because it has more chances to be a better summary */}} prefer using it because it has more chances to be a better summary -->
{{ if (isset .Params "summary" )}} {{ if (isset .Params "summary" )}}
{{ .Params.summary }} {{ .Params.summary }}
{{ else }} {{ else }}

View File

@ -5,26 +5,26 @@
{{ $styleCustom := resources.Get "css/custom.css" }} {{ $styleCustom := resources.Get "css/custom.css" }}
<link rel="stylesheet" href="{{ $styleBulma.Permalink }}"> <link rel="stylesheet" href="{{ $styleBulma.Permalink }}">
<link rel="stylesheet" href="{{ $styleCustom.Permalink }}"> <link rel="stylesheet" href="{{ $styleCustom.Permalink }}">
{{/* RSS feed */}} <!-- RSS feed -->
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}} {{ end -}}
{{/* Default to home image */}} <!-- Default to home image -->
{{ $image := resources.Get "img/home.jpg" }} {{ $image := resources.Get "img/home.jpg" }}
{{/* If header image exists in current context, use it instead */}} <!-- If header image exists in current context, use it instead -->
{{ with .Resources.GetMatch "top.jpg" }} {{ with .Resources.GetMatch "top.jpg" }}
{{ $image = . }} {{ $image = . }}
{{ end }} {{ end }}
{{ $image = $image.Resize "3000x" }} {{ $image = $image.Resize "3000x" }}
{{ $image := $image | images.Filter (images.GaussianBlur 7) }} {{ $image := $image | images.Filter (images.GaussianBlur 7) }}
{{/* tbh I am too lazy to extend Bulma, so put dirty CSS directives here to be able to use Hugo templating system */}} <!-- tbh I am too lazy to extend Bulma, so put dirty CSS directives here to be able to use Hugo templating system -->
<style> <style>
.has-bg-img { .has-bg-img {
background: url('{{ $image.Permalink }}')center center; background: url('{{ $image.Permalink }}')center center;
background-size: cover; background-size: cover;
} }
</style> </style>
{{/* Favico */}} <!-- Favico -->
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png"> <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png">

View File

@ -1,6 +1,6 @@
{{/* Allow to skip heading, for example in an about page */}} <!-- Allow to skip heading, for example in an about page -->
{{ if not .Params.noheader }} {{ if not .Params.noheader }}
{{/* Display background only for regular pages, or home */}} <!-- Display background only for regular pages, or home -->
{{ $background := in "page home" .Kind }} {{ $background := in "page home" .Kind }}
{{ $page := eq "page" .Kind }} {{ $page := eq "page" .Kind }}
{{ $home := eq "home" .Kind }} {{ $home := eq "home" .Kind }}
@ -37,7 +37,7 @@
{{ end }} {{ end }}
</div> </div>
</div> </div>
{{/* Words and date stuff makes sens only for blog posts, not other pages */}} <!-- Words and date stuff makes sens only for blog posts, not other pages -->
{{ if (and .IsPage (eq .FirstSection.Section "posts"))}} {{ if (and .IsPage (eq .FirstSection.Section "posts"))}}
<div class="hero-foot mb-5 mx-5 content"> <div class="hero-foot mb-5 mx-5 content">
<div class="level"> <div class="level">

View File

@ -17,7 +17,7 @@
</a> </a>
</div> </div>
<div id="navbar" class="navbar-menu"> <div id="navbar" class="navbar-menu">
{{/* In case of another navbar-start right after */}} <!-- In case of another navbar-start right after -->
<div class="navbar-start mr-0"> <div class="navbar-start mr-0">
<div class="navbar-item has-dropdown is-hoverable"> <div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link"> <a class="navbar-link">
@ -47,14 +47,14 @@
</div> </div>
</div> </div>
</div> </div>
{{/* start/end menu shares the exact same code, just not the same position, factorize with a loop */}} <!-- start/end menu shares the exact same code, just not the same position, factorize with a loop -->
{{ $currentPage := . }} {{ $currentPage := . }}
{{ range (slice "start" "end")}} {{ range (slice "start" "end")}}
{{ $menuName := . }} {{ $menuName := . }}
<div class="navbar-{{ . }} mr-2"> <div class="navbar-{{ . }} mr-2">
{{/* now get the menu if it exists */}} <!-- now get the menu if it exists -->
{{ with index $.Site.Menus $menuName }} {{ with index $.Site.Menus $menuName }}
{{/* and range over its pages */}} <!-- and range over its pages -->
{{ range . }} {{ range . }}
{{ if .HasChildren }} {{ if .HasChildren }}
<div class="navbar-item has-dropdown is-hoverable {{ if $currentPage.HasMenuCurrent $menuName . }}is-active is-tab{{ end }}"> <div class="navbar-item has-dropdown is-hoverable {{ if $currentPage.HasMenuCurrent $menuName . }}is-active is-tab{{ end }}">
@ -79,14 +79,14 @@
<div class="level"> <div class="level">
<div class="level-left"> <div class="level-left">
<div class="level-item"> <div class="level-item">
{{/* Each item should have a corresponding assets/img/x.png and link in config.yaml */}} <!-- Each item should have a corresponding assets/img/x.png and link in config.yaml -->
{{ range (slice "rss" "mastodon" "peertube" "funkwhale" "gitea" "mail" )}} {{ range (slice "rss" "mastodon" "peertube" "funkwhale" "gitea" "mail" )}}
{{ $imageName := . }} {{ $imageName := . }}
{{/* Get image and resize to logo size */}} <!-- Get image and resize to logo size -->
{{ $imagePath := printf "img/%s.png" $imageName }} {{ $imagePath := printf "img/%s.png" $imageName }}
{{ $image := resources.Get $imagePath }} {{ $image := resources.Get $imagePath }}
{{ $imageResized := $image.Resize "64x" }} {{ $imageResized := $image.Resize "64x" }}
{{/* Get logo link in site params (index allows to use a dynamic parameter name) */}} <!-- Get logo link in site params (index allows to use a dynamic parameter name) -->
<a class="navbar-item" href="{{ index $.Site.Params $imageName }}"> <a class="navbar-item" href="{{ index $.Site.Params $imageName }}">
<img src="{{ $imageResized.Permalink }}"> <img src="{{ $imageResized.Permalink }}">
</a> </a>

View File

@ -63,7 +63,7 @@
{{- end -}} {{- end -}}
{{- with .Get "width" }} width="{{ . }}"{{ end -}} {{- with .Get "width" }} width="{{ . }}"{{ end -}}
{{- with .Get "height" }} height="{{ . }}"{{ end -}} {{- with .Get "height" }} height="{{ . }}"{{ end -}}
/> {{/* Closing img tag */}} /> <!-- Closing img tag -->
{{- if .Get "link" }}</a>{{ end -}} {{- if .Get "link" }}</a>{{ end -}}
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
<figcaption> <figcaption>

View File

@ -41,12 +41,6 @@ p:not(.title, .subtitle, figcaption p) {
background: rgba(0, 0, 0, 0.3); background: rgba(0, 0, 0, 0.3);
} }
/* Used to disable click on incoming posts in thematic series */
a.disabled {
pointer-events: none;
cursor: default;
}
/* New font is "smaller" in feeling */ /* New font is "smaller" in feeling */
.navbar-dropdown { .navbar-dropdown {
font-size: 1rem; font-size: 1rem;