2021-05-11 10:01:24 +02:00
|
|
|
{{ define "main" }}
|
2021-05-26 19:03:43 +02:00
|
|
|
<div class="section">
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/*
|
2023-08-10 15:22:13 +02:00
|
|
|
If the current page is a blog post and belongs to a thematic serie, add a side menu
|
2021-10-22 12:42:40 +02:00
|
|
|
with all other blog posts belonging to that case, emphasis to the current.
|
|
|
|
Still use empty container if nothing to show for homogeneous layout
|
2023-08-10 15:23:42 +02:00
|
|
|
*/}}
|
|
|
|
{{/* is-desktop stacks vertically columns for tablets and mobiles. is-8 is a
|
|
|
|
maximum gap of 2rem between columns */}}
|
2023-07-04 13:02:28 +02:00
|
|
|
<div class="columns is-variable is-desktop is-8">
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/* To ease reading, the content is a bit wider for small screens
|
|
|
|
but not too wide for big screens */}}
|
2023-07-04 16:06:06 +02:00
|
|
|
<aside class="menu column mt-2 is-one-fifth-desktop is-one-fifth-fullhd is-full-tablet is-full-mobile">
|
2022-11-07 01:15:03 +01:00
|
|
|
{{ if (and .IsPage (eq .FirstSection.Section "posts"))}}
|
|
|
|
{{ with .CurrentSection }}
|
|
|
|
{{ if .Params.Title }}
|
|
|
|
<p class="menu-label">
|
|
|
|
<a href="{{ .Permalink }}">{{ .Params.Title }}</a>
|
|
|
|
</p>
|
|
|
|
<div class="menu-list">
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/* Get all posts belonging to the current thematic serie, sorted by date */}}
|
2022-11-07 01:15:03 +01:00
|
|
|
{{ $posts := (where $.Site.RegularPages "CurrentSection.Params.Code" "==" $.CurrentSection.Params.Code )}}
|
|
|
|
{{ $postsSorted := (sort $posts "Date" )}}
|
|
|
|
{{ range $postsSorted }}
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/* Show titles for incoming posts, but do not make them clickable. Note
|
2023-08-10 15:22:13 +02:00
|
|
|
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
|
2023-08-10 15:23:42 +02:00
|
|
|
something it should be marked as "draft: true" so the page is not built. */}}
|
2023-08-10 15:22:13 +02:00
|
|
|
{{ if eq .Params.incoming true }}
|
|
|
|
<a class="disabled">{{ .Title }} <i class="has-text-grey">(à venir)</i></a>
|
|
|
|
{{ else }}
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/* Otherwise link to the posts, highlightning the current one */}}
|
2022-11-07 01:15:03 +01:00
|
|
|
<a {{ if eq $.Title .Title }} class="is-active" {{ end }} href="{{ .Permalink }}">{{ .Title }}</a>
|
|
|
|
{{ end }}
|
2023-08-10 15:22:13 +02:00
|
|
|
{{ end }}
|
2022-11-07 01:15:03 +01:00
|
|
|
</div>
|
2021-10-22 12:42:40 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
2022-11-07 01:15:03 +01:00
|
|
|
</aside>
|
2023-07-04 16:06:06 +02:00
|
|
|
<section class="column content is-three-fifths-desktop is-three-fifths-fullhd is-full-tablet is-full-mobile">
|
2022-11-07 01:15:03 +01:00
|
|
|
<div>
|
|
|
|
<article>
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/* If this is part of a thematic serie, remind it so it is clear */}}
|
2023-07-03 16:22:05 +02:00
|
|
|
{{ if (and .IsPage (eq .FirstSection.Section "posts"))}}
|
|
|
|
{{ with .CurrentSection }}
|
|
|
|
{{ if .Params.Title }}
|
|
|
|
<div class="message is-info">
|
|
|
|
<div class="message-body content">
|
2023-07-04 17:20:03 +02:00
|
|
|
Le billet que vous lisez fait partie du dossier « <a href="{{ .Permalink }}">{{ .Params.Title }}</a> ». Le
|
|
|
|
menu sur la gauche permet de naviguer entre ses parties. Bonne lecture ! 😄
|
2023-07-03 16:22:05 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/* First thing is a legend for the hero image, if it exists */}}
|
2022-11-07 01:15:03 +01:00
|
|
|
{{ with .Params.imgExplanation }}
|
2023-07-03 16:22:05 +02:00
|
|
|
<div class="message">
|
2022-11-07 01:15:03 +01:00
|
|
|
<div class="message-body content is-italic">
|
2023-08-09 23:09:34 +02:00
|
|
|
{{ . | markdownify }}
|
2021-05-26 19:03:43 +02:00
|
|
|
</div>
|
2023-07-03 16:22:05 +02:00
|
|
|
</div>
|
2022-11-07 01:15:03 +01:00
|
|
|
{{ end }}
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/* Second, an introductive message before ToC, if it exists */}}
|
2023-01-20 19:13:52 +01:00
|
|
|
{{ with .Params.intro | markdownify | safeHTML }}
|
2022-11-07 01:15:03 +01:00
|
|
|
<div class="message is-dark">
|
|
|
|
<div class="message-body">
|
|
|
|
{{ . }}
|
2021-05-26 19:03:43 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-11-07 01:15:03 +01:00
|
|
|
{{ end }}
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/* Then, ToC if text has more than 600 words and not explicitly asked not to */}}
|
2022-11-07 01:15:03 +01:00
|
|
|
{{ if (and (not .Params.notoc) (gt .WordCount 600)) }}
|
|
|
|
<div class="message is-link">
|
|
|
|
<div class="message-header">Sommaire</div>
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/* Appreciate this horrible trick, even a 2000's HTML generator won't generate such code */}}
|
2023-07-04 13:02:28 +02:00
|
|
|
<div class="message-body has-text-left pt-1">
|
|
|
|
{{ .TableOfContents | replaceRE "<a" "<a style='text-decoration:none;'" | safeHTML }}</div>
|
2022-11-07 01:15:03 +01:00
|
|
|
</div>
|
|
|
|
{{ end }}
|
2023-08-10 15:23:42 +02:00
|
|
|
{{/* Finally, content! */}}
|
2022-11-07 01:15:03 +01:00
|
|
|
{{ .Content }}
|
|
|
|
</article>
|
|
|
|
</div>
|
|
|
|
<hr />
|
|
|
|
</section>
|
|
|
|
</div>
|
2023-07-04 13:02:28 +02:00
|
|
|
</div>
|
|
|
|
{{ end }}
|