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 @@
{{- partial "media/render-image.html" . -}}

View File

@@ -0,0 +1,28 @@
{{- $isExternal := strings.HasPrefix .Destination "http" -}}
{{- $parsed := urls.Parse .Destination -}}
{{- $host := $parsed.Host -}}
{{- $path := $parsed.Path -}}
{{- $query := $parsed.RawQuery -}}
{{- $aff := index site.Data.affiliates.sites $host -}}
{{- $isAffiliated := false -}}
{{- $newURL := .Destination -}}
{{- if and $isExternal $aff -}}
{{- $param := $aff.param -}}
{{- $value := $aff.value -}}
{{- $isAffiliated = true -}}
{{- if $query }}
{{- $newURL = printf "%s://%s%s?%s&%s=%s" $parsed.Scheme $host $path $query $param $value -}}
{{- else }}
{{- $newURL = printf "%s://%s%s?%s=%s" $parsed.Scheme $host $path $param $value -}}
{{- end }}
{{- end -}}
{{- $titlePrefix := "" -}}
{{- if $isAffiliated -}}
{{- $titlePrefix = "Lien affilié" -}}
{{- else if $isExternal -}}
{{- $titlePrefix = "Lien externe" -}}
{{- end -}}
<a href="{{ $newURL }}" title="{{ $titlePrefix }}{{ .Title }}"
{{- if $isExternal -}} rel="noreferrer" class="external{{ if $isAffiliated }} affiliated{{ end }}" {{- end -}}>
{{- .Text | safeHTML -}}
</a>

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 }}

View File

@@ -0,0 +1,30 @@
{{- $imageURL := .Get 0 -}}
{{- $alignment := .Get 1 | default "center" -}}
{{- $title := .Get 2 | default "" -}}
{{- $description := .Get 3 | default "" -}}
{{- $attribution := .Get 4 | default "" -}}
{{- $imageURL := printf "%s?raw=true" $imageURL -}}
{{- $remoteImage := resources.GetRemote $imageURL -}}
{{- $hash := md5 $imageURL -}}
{{- $extension := path.Ext $imageURL -}}
{{- $cleanFilename := printf "%s%s" $hash $extension -}}
{{- $cleanFilename := replace $cleanFilename "?raw=true" "" -}}
{{- $localImage := $remoteImage | resources.Copy (printf "remote-images/%s" $cleanFilename) -}}
{{- $width := (cond (eq $alignment "center") "1024x" "500x") -}}
{{- $resizedImage := $localImage.Resize $width -}}
<figure class="custom-image {{ $alignment }}">
<a href="{{ $localImage.RelPermalink }}" title="Cliquez pour agrandir l'image">
<img src="{{ $resizedImage.RelPermalink }}" alt="{{ $title }}" title="{{ $title }}" />
</a>
{{- with $attribution }}
<p class="details">
<strong>Attribution :</strong>
<em>{{ . | markdownify }}</em>
</p>
{{- end }}
{{- with $description }}
<figcaption>
<p>{{ .| markdownify }}</p>
</figcaption>
{{- end }}
</figure>

View File

@@ -0,0 +1,28 @@
{{- $soundData := .Get 0 -}}
{{- $alignment := .Get 1 | default "center" -}}
{{- $dataFile := .Page.Resources.Get (printf "data/sounds/%s.yaml" $soundData) -}}
{{- if $dataFile -}}
{{- $data := $dataFile.Content | transform.Unmarshal -}}
{{- $audio := .Page.Resources.Get $data.file -}}
{{- if $audio -}}
<figure class="custom-sound {{ $alignment }}">
<audio controls preload="metadata">
<source src="{{ $audio.RelPermalink }}">
Votre navigateur ne prend pas en charge la lecture audio.
</audio>
{{- if or $data.title (or $data.description $data.attribution) }}
<figcaption>
{{- with $data.title }}
<p><strong>{{ . }}</strong></p>
{{- end }}
{{- with $data.description }}
<p>{{ . | markdownify }}</p>
{{- end }}
{{- with $data.attribution }}
<p class="details"><strong>Attribution :</strong> <em>{{ . | markdownify }}</em></p>
{{- end }}
</figcaption>
{{- end }}
</figure>
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,44 @@
{{- $videoData := .Get 0 -}}
{{- $alignment := .Get 1 | default "center" -}}
{{- $dataFile := .Page.Resources.Get (printf "data/videos/%s.yaml" $videoData) -}}
{{- if $dataFile -}}
{{- $data := $dataFile.Content | transform.Unmarshal -}}
{{- $video := .Page.Resources.Get $data.file -}}
{{- if $video -}}
<figure class="custom-video {{ $alignment }}">
<video controls preload="metadata" width="100%">
<source src="{{ $video.RelPermalink }}" type="video/mp4">
Votre navigateur ne prend pas en charge la lecture des vidéos.
</video>
{{- if $data.prompt }}
<details>
<summary>
<strong>Attribution :</strong>
{{- with $data.attribution }}
<em>{{ . | markdownify }}</em>
{{- end }}
</summary>
{{- with $data.prompt }}
<p><strong>Prompt :</strong> <em>{{ . }}</em></p>
{{- end }}
</details>
{{- with $data.description }}
<figcaption>
<p>{{ .| markdownify }}</p>
</figcaption>
{{- end }}
{{- else }}
{{- with $data.attribution }}
<p class="details">
<strong>Attribution :</strong>
<em>{{ . | markdownify }}</em>
</p>
{{- end }}{{- with $data.description }}
<figcaption>
<p>{{ .| markdownify }}</p>
</figcaption>
{{- end }}
{{- end }}
</figure>
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="{{ site.Language.LanguageCode }}" dir="{{ or site.Language.LanguageDirection `ltr` }}">
<head>
{{ partial "head.html" . }}
</head>
<body>
{{ block "main" . }}{{ end }}
{{ partial "footer.html" . }}
</body>
</html>

View File

@@ -0,0 +1,41 @@
{{- define "main" }}
{{- $site := .Site -}}
{{- $allArticles := $site.RegularPages.ByDate.Reverse -}}
{{- $allSections := where $site.Pages "Kind" "section" -}}
{{- $allSections = where $allSections "RelPermalink" "!=" "/" -}}
{{- $leafSections := slice -}}
{{- range $allSections -}}
{{- if eq (len .Sections) 0 -}}
{{- $leafSections = $leafSections | append . -}}
{{- end -}}
{{- end -}}
{{- partial "hero.html" . -}}
{{- $used := slice -}}
<main id="home">
{{- $recent := first 4 ($allArticles) -}}
{{- range $recent }}
{{- $used = $used | append .File.Path -}}
{{- end -}}
{{- partial "home-section.html" (dict "SectionPages" $recent "Title" "Dernières publications" "Context" .) -}}
{{- range sort $leafSections "Lastmod" "desc" -}}
{{- $section := . -}}
{{- $sectionPages := slice -}}
{{- range $section.RegularPagesRecursive.ByDate.Reverse -}}
{{- if not (in $used .File.Path) -}}
{{- $sectionPages = $sectionPages | append . -}}
{{- end -}}
{{- end -}}
{{- $sectionPages = first 4 $sectionPages -}}
{{- if gt (len $sectionPages) 0 -}}
{{- range $sectionPages -}}
{{- $used = $used | append .File.Path -}}
{{- end -}}
{{- partial "home-section.html" (dict "SectionPages" $sectionPages "Section" $section "Context" .) -}}
{{- end -}}
{{- end -}}
</main>
{{- end }}

View File

@@ -0,0 +1,30 @@
{{ define "main" }}
{{ partial "hero-page.html" . }}
<main>
<article class="article-body">
{{- if eq .Page.Parent.RelPermalink "/interets/liens-interessants/" -}}
{{- else -}}
{{- if .Params.cover -}}
{{- partial "media/render-image.html" (dict
"Page" .Page
"Destination" .Params.cover
) -}}
{{- end -}}
{{- end -}}
{{ with .TableOfContents }}
{{ if gt (len (plainify .)) 0 }}
<div class="stat">
<strong>
Sommaire
</strong>
{{ . | safeHTML }}
</div>
{{ end }}
{{ end }}
{{ .Content }}
</article>
</main>
{{ end }}

View File

@@ -0,0 +1,8 @@
{{ define "main" }}
{{ partial "hero-section.html" . }}
<main>
{{ .Content }}
{{- partial "articles-list.html" (dict "Pages" .Pages.ByDate.Reverse "Context" .) -}}
</main>
{{ end }}

View File

@@ -0,0 +1,7 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ range .Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}
{{ end }}

View File

@@ -0,0 +1,7 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ range .Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}
{{ end }}