1

Introduction du nouveau thème

This commit is contained in:
2025-10-11 00:36:18 +02:00
parent fa5ba208ed
commit 2653b0fa01
112 changed files with 1590 additions and 2766 deletions

View File

@@ -0,0 +1,8 @@
{{- $pages := .Pages -}}
{{- $context := .Context -}}
{{- $count := len $pages -}}
<nav class="articles-list">
{{- range $pages }}
{{- partial "card.html" . -}}
{{- end }}
</nav>

View File

@@ -0,0 +1,9 @@
{{- $logoPath := .Site.Params.logo | default "logo-large.png" -}}
{{- $logo := resources.GetMatch $logoPath -}}
<section id="big-logo">
<img src="{{ $logo.RelPermalink }}" alt="Logo de {{ .Site.Title }}" />
<hgroup>
<h1>{{ .Site.Title }}</h1>
<p>{{ .Site.Params.description }}</p>
</hgroup>
</section>

View File

@@ -0,0 +1,19 @@
{{- $page := . -}}
{{- with .Page -}}
{{- $page = . -}}
{{- end -}}
{{- if or $page.IsPage $page.IsSection -}}
{{- $trail := slice -}}
{{- range $page.Ancestors.Reverse -}}
{{- if ne .RelPermalink "/" -}}
{{- $trail = $trail | append . -}}
{{- end -}}
{{- end -}}
{{- if gt (len $trail) 0 -}}
<nav class="breadcrumbs" aria-label="Fil dAriane">
{{- range $item := $trail -}}
<a href="{{ $item.RelPermalink }}">{{ with $item.LinkTitle }}{{ . }}{{ else }}{{ $item.Title }}{{ end }}</a>
{{- end -}}
</nav>
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,51 @@
<a href="{{ .RelPermalink }}" class="card panel panel-hero">
{{ $page := . -}}
{{- $coverPath := .Params.cover -}}
{{- $img := false -}}
{{- if $coverPath -}}
{{- if strings.HasSuffix $coverPath ".yaml" -}}
{{- $coverAbsPath := printf "%s%s" $page.File.Dir $coverPath -}}
{{- $coverRaw := readFile $coverAbsPath -}}
{{- $coverData := $coverRaw | transform.Unmarshal -}}
{{- with $coverData.file -}}
{{- $img = $page.Resources.GetMatch . -}}
{{- end -}}
{{- else -}}
{{- $img = $page.Resources.GetMatch $coverPath -}}
{{- end -}}
{{- end -}}
{{- if $img -}}
{{- with $img -}}
{{- $resized := .Fill "450x220" -}}
<div class="card-image" style="background-image: url({{ $resized.RelPermalink }});"></div>
{{ end -}}
{{ else }}<div class="card-image"></div>
{{ end -}}
<div class="card-content">
<h3>{{ .Title }}</h3>
{{- if not $page.IsSection -}}
{{- with $page.Date -}}
<time datetime="{{ . }}">{{ . | time.Format ":date_long" }}</time>
{{- end -}}
{{- end -}}
<div class="card-meta">
{{ $section := "" -}}
{{- with .Parent -}}
{{- $sectionPath := path.Base .File.Dir -}}
{{- $section = $sectionPath -}}
{{- end -}}
<span class="section section-{{ $section }}">{{ .Parent.LinkTitle }}</span>
<span class="reading-time">
{{ if .IsSection -}}
{{- $count := len .Pages -}}
{{- $label := cond (eq $count 1) "article" "articles" -}}
{{- $count }} {{ $label -}}
{{- else -}}
{{- if ge .ReadingTime 5 -}}
{{- .ReadingTime }} min de lecture
{{- end -}}
{{- end }}
</span>
</div>
</div>
</a>

View File

@@ -0,0 +1,53 @@
{{- $current := . }}
{{- $currentTitle := .Title }}
{{- $position := .Scratch.Get "paginationPosition" | default "up" }}
{{- with index .Params.dossier 0 }}
{{- $dossierID := . }}
{{- $allPages := site.RegularPages }}
{{- $filtered := where $allPages "Params.dossier" "intersect" (slice $dossierID) }}
{{- $valid := where $filtered "Weight" "gt" 0 }}
{{- $sorted := sort $valid "Weight" }}
{{- if gt (len $sorted) 1 }}
{{- $index := -1 }}
{{- range $i, $p := $sorted }}
{{- if eq $p.Permalink $current.Permalink }}
{{- $index = $i }}
{{- end }}
{{- end }}
{{- $prev := index $sorted (sub $index 1) }}
{{- $next := index $sorted (add $index 1) }}
{{- with $dossierID -}}
<div class="sup-title">{{ . }}</div>
{{- end -}}
<nav class="pagination" aria-label="Sommaire du dossier">
{{- if ge $index 1 }}
<a class="prev" href="{{ $prev.RelPermalink }}" title="Page précédente"></a>
{{- else }}
<span class="disabled prev"></span>
{{- end }}
<details class="{{ $position }}">
<summary>Sommaire</summary>
<ul class="stat">
{{- range $i, $p := $sorted }}
<li>
{{- if eq $p.Permalink $current.Permalink }}
<span class="current">{{ $p.Title }}</span>
{{- else }}
<a href="{{ $p.RelPermalink }}">{{ $p.Title }}</a>
{{- end }}
</li>
{{- end }}
</ul>
</details>
{{- if lt (add $index 1) (len $sorted) }}
<a class="next" href="{{ $next.RelPermalink }}" title="Page suivante"></a>
{{- else }}
<span class="disabled next"></span>
{{- end }}
</nav>
{{- end }}
{{- end }}

View File

@@ -0,0 +1,25 @@
<footer>
<hr class="mirror" />
{{ range site.Menus.main -}}
<section>
<header>
<h2>{{ if .PageRef }}
<a href="{{ .PageRef }}" title="{{ .Title }}">{{ .Name }}</a>
{{ else }}
<span>{{ .Name }}</span>
{{ end }}</h2>
</header>
<nav>
{{ range .Children -}}
{{ if .PageRef }}
<a href="{{ .PageRef }}" title="{{ .Title }}">{{ .Name }}</a>
{{ else }}
<span title="{{ .Title }}">{{ .Name }}</span>
{{ end }}
{{ end }}
</nav>
</section>
{{ end }}
<p>Sauf mention contraire, l'intégralité du contenu de ce site est disponible sous licence <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/">CC BY-NC-ND</a>.</p>
</footer>

View File

@@ -0,0 +1,4 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
{{ partialCached "head/css.html" . }}

View File

@@ -0,0 +1,9 @@
{{- $mainCSS := resources.Get "css/index.css" | postCSS (dict "inlineImports" true) -}}
{{- $bundle := slice $mainCSS | resources.Concat "css/bundle.css" -}}
{{- if eq hugo.Environment "development" -}}
<link rel="stylesheet" href="{{ $bundle.RelPermalink }}" type="text/css" />
{{- else -}}
{{- with $bundle | minify | fingerprint -}}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" type="text/css" />
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,7 @@
<header id="hero-page" class="panel panel-hero">
{{ partialCached "site-title.html" . }}
{{- partial "dossier-summary" . -}}
<h1>{{ .Title }}</h1>
{{ partial "page-meta.html" . }}
{{ partial "page-links.html" . }}
</header>

View File

@@ -0,0 +1,7 @@
<header id="hero-page" class="panel-hero">
{{ partialCached "site-title.html" . }}
<div class="page-meta">
{{ partial "breadcrumbs.html" . }}
</div>
<h1>{{ .Title }}</h1>
</header>

View File

@@ -0,0 +1,4 @@
<header class="panel-hero" id="hero">
{{- partialCached "big-logo.html" . -}}
{{- partialCached "site-stats.html" . -}}
</header>

View File

@@ -0,0 +1,19 @@
{{- $section := .Section -}}
{{- $sectionPages := default (slice) .SectionPages -}}
{{- $title := .Title -}}
{{- $context := default . .Context -}}
<section>
<header>
{{- with $section -}}
{{- partial "breadcrumbs.html" . -}}
<h2><a href="{{ .RelPermalink }}">{{ with .LinkTitle }}{{ . }}{{ else }}{{ .Title }}{{ end }}</a></h2>
{{- else -}}
{{- with $title -}}
<h2>{{ . }}</h2>
{{- end -}}
{{- end -}}
</header>
{{- partial "articles-list.html" (dict "Pages" $sectionPages "Context" $context) -}}
</section>
<hr />

View File

@@ -0,0 +1,6 @@
{{ if and (.Parent) (ne .Parent.RelPermalink "/") }}
{{- $sectionPath := path.Base .Parent.File.Dir -}}
<a href="{{ .Parent.RelPermalink }}" title="Retour à la section {{ .Parent.LinkTitle }}" class="section-{{ $sectionPath }}">
{{ or .Parent.LinkTitle "Section" }}
</a>
{{ end }}

View File

@@ -0,0 +1,41 @@
{{- $imgPath := .Destination -}}
{{- $imgName := path.Base $imgPath | replaceRE "\\.[^.]+$" "" -}} {{/* Supprime l'extension */}}
{{- $dataPath := printf "data/images/%s.yaml" $imgName -}}
{{- $dataFile := .Page.Resources.Get $dataPath -}}
{{- $data := dict -}}
{{- if $dataFile }}
{{- $data = $dataFile.Content | transform.Unmarshal -}}
{{- end }}
{{- $alt := .PlainText | default $data.title | default "" -}}
{{- $title := .Title | default $data.title | default .Page.Title -}}
{{- $description := default $data.description | default $title -}}
{{- $image := .Page.Resources.GetMatch $imgPath -}}
{{- $display := $image }}
{{- if gt $display.Height 810 }}
{{- $display = $image.Resize "x810" -}}
{{- end }}
<figure>
{{- with $description }}
<figcaption>
<p>{{ . | markdownify }}</p>
</figcaption>
{{- end }}
<a href="{{ $image.RelPermalink }}" title="Cliquez pour agrandir l'image">
<img src="{{ $display.RelPermalink }}" alt="{{ $alt }}" title="{{ $title }}" />
</a>
{{- if $data.prompt }}
<details>
<summary>
<strong>Attribution : {{- with $data.attribution }}<em>{{ . | markdownify }}</em>{{- end }}</strong>
</summary>
<p><strong>Prompt :</strong> <em>{{ $data.prompt }}</em></p>
</details>
{{- else }}
{{- with $data.attribution }}
<p class="details">
<strong>Attribution :</strong>
<em>{{ . | markdownify }}</em>
</p>
{{- end }}
{{- end }}
</figure>

View File

@@ -0,0 +1,51 @@
{{- /*
Renders a menu for the given menu ID.
@context {page} page The current page.
@context {string} menuID The menu ID.
@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }}
*/}}
{{- $page := .page }}
{{- $menuID := .menuID }}
{{- with index site.Menus $menuID }}
<nav>
<ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul>
</nav>
{{- end }}
{{- define "_partials/inline/menu/walk.html" }}
{{- $page := .page }}
{{- range .menuEntries }}
{{- $attrs := dict "href" .URL }}
{{- if $page.IsMenuCurrent .Menu . }}
{{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }}
{{- else if $page.HasMenuCurrent .Menu .}}
{{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
{{- end }}
{{- $name := .Name }}
{{- with .Identifier }}
{{- with T . }}
{{- $name = . }}
{{- end }}
{{- end }}
<li>
<a
{{- range $k, $v := $attrs }}
{{- with $v }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end -}}
>{{ $name }}</a>
{{- with .Children }}
<ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul>
{{- end }}
</li>
{{- end }}
{{- end }}

View File

@@ -0,0 +1,7 @@
{{ if .Params.links }}
<nav id="page-links">
{{ range .Params.links }}
<a href="{{ .url }}" rel="noopener noreferer norelated">{{ .name }}</a>
{{ end }}
</nav>
{{ end }}

View File

@@ -0,0 +1,9 @@
<div class="page-meta">
{{ with .Date }}
<time datetime="{{ . }}">{{ . | time.Format ":date_long" }}</time>
{{ end }}
{{ partial "breadcrumbs.html" . }}
{{- if ge .ReadingTime 5 -}}
<span>{{- .ReadingTime }} min de lecture</span>
{{- end -}}
</div>

View File

@@ -0,0 +1,22 @@
{{- $site := .Site -}}
{{- $title := $site.Title -}}
{{- $totalArticles := len $site.RegularPages -}}
{{- $allSections := where $site.Pages "Kind" "section" -}}
{{- $allSections = where $allSections "RelPermalink" "!=" "/" -}}
{{- $leafSections := slice -}}
{{- range $allSections -}}
{{- if eq (len .Sections) 0 -}}
{{- $leafSections = $leafSections | append . -}}
{{- end -}}
{{- end -}}
{{- $sectionsCount := len $leafSections -}}
{{- $lastMod := $site.Lastmod | time.Format "02/01/2006" -}}
<section id="site-stats">
<hr class="mirror" />
<div aria-label="Statistiques" class="stats">
{{ partial "stat.html" (dict "title" "Articles publiés" "value" $totalArticles)}}
{{ partial "stat.html" (dict "title" "Thématiques" "value" $sectionsCount)}}
{{ partial "stat.html" (dict "title" "Dernière mise à jour" "value" $lastMod)}}
</div>
<hr />
</section>

View File

@@ -0,0 +1,7 @@
<a id="site-title" href="/">
{{- $logoPath := .Params.logo | default "logo-large.png" -}}
{{- $logo := resources.GetMatch $logoPath -}}
{{- $resized := $logo.Resize "64x" -}}
<img src="{{ $resized.RelPermalink }}" alt="" />
<span>{{ .Site.Title }}</span>
</a>

View File

@@ -0,0 +1,4 @@
<div class="panel stat">
<strong>{{ .title }}</strong>
<span>{{ .value }}</span>
</div>

View File

@@ -0,0 +1,23 @@
{{- /*
For a given taxonomy, renders a list of terms assigned to the page.
@context {page} page The current page.
@context {string} taxonomy The taxonomy.
@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
*/}}
{{- $page := .page }}
{{- $taxonomy := .taxonomy }}
{{- with $page.GetTerms $taxonomy }}
{{- $label := (index . 0).Parent.LinkTitle }}
<div>
<div>{{ $label }}:</div>
<ul>
{{- range . }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- end }}
</ul>
</div>
{{- end }}