Future posts of thematic series can be marked as 'incoming'

So they are not listed, but are shown in the thematic case's navigation menu to get an idea of what's coming next
master
Quentin Duchemin 2023-08-10 15:22:13 +02:00
parent e80cac8c43
commit 3327af7df0
Signed by: Chosto
GPG Key ID: 96AB8AE7DFEA3D74
3 changed files with 24 additions and 5 deletions

View File

@ -5,16 +5,19 @@
<div class="container is-max-widescreen">
<main>
<div class="columns is-multiline">
<!-- Custom paginator with only blog posts (e.g. avoid "À propos"),
<!-- Custom paginator with only blog posts (e.g. avoid "À propos") which
are already written (avoid "incoming" posts of thematic series),
ordered from newest to oldest -->
{{ $paginator := .Paginator }}
{{ $paginator := .Paginate
(where
(where site.RegularPages ".Type" "in" site.Params.mainSections)
".Params.incoming" "!=" true)
}}
{{ range $paginator.Pages }}
{{ if (eq .FirstSection.Section "posts")}}
<div class="column is-variable is-one-third">
{{ .Render "summary" }}
</div>
{{ end }}
{{ end }}
</div>
{{- partial "pagination.html" $paginator -}}
</main>

View File

@ -1,7 +1,7 @@
{{ define "main" }}
<div class="section">
<!--
If the current page is a blog post and belongs to a thematic serie, we will add a side menu
If the current page is a blog post and belongs to a thematic serie, add a side menu
with all other blog posts belonging to that case, emphasis to the current.
Still use empty container if nothing to show for homogeneous layout
-->
@ -18,11 +18,21 @@
<a href="{{ .Permalink }}">{{ .Params.Title }}</a>
</p>
<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 )}}
{{ $postsSorted := (sort $posts "Date" )}}
{{ 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>
{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}

View File

@ -41,6 +41,12 @@ p:not(.title, .subtitle, figcaption p) {
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 */
.navbar-dropdown {
font-size: 1rem;