Initial commit
This commit is contained in:
55
themes/default/layouts/_default/_markup/render-image.html
Normal file
55
themes/default/layouts/_default/_markup/render-image.html
Normal file
@@ -0,0 +1,55 @@
|
||||
{{- $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 "" -}}
|
||||
{{- $image := .Page.Resources.GetMatch $imgPath -}}
|
||||
{{- $isBlock := .IsBlock -}}
|
||||
{{- if $image }}
|
||||
{{- $resized := $image.Resize (cond (eq $isBlock true) "1024x" "500x") -}}
|
||||
{{- $large := $image.Resize "1920x" -}}
|
||||
{{- if $isBlock }}
|
||||
<figure class="custom-image center">
|
||||
<a href="{{ $large.RelPermalink }}" title="Cliquez pour agrandir l'image">
|
||||
<img src="{{ $resized.RelPermalink }}" alt="{{ $alt }}" title="{{ $title }}" />
|
||||
</a>
|
||||
{{- if $data.prompt }}
|
||||
<details>
|
||||
<summary>
|
||||
<strong>Attribution :</strong>
|
||||
{{- with $data.attribution }}<em>{{ . | markdownify }}</em>{{- end }}
|
||||
</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 }}
|
||||
<figcaption>
|
||||
{{- with $data.description }}
|
||||
<p>{{ . | markdownify }}</p>
|
||||
{{- end }}
|
||||
</figcaption>
|
||||
{{- end }}
|
||||
</figure>
|
||||
{{- else }}
|
||||
<img src="{{ $resized.RelPermalink }}" alt="{{ $alt }}" title="{{ $title }}">
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- if $isBlock }}
|
||||
<figure>
|
||||
<img src="{{ $imgPath | safeURL }}" alt="{{ $alt }}" title="{{ $title }}">
|
||||
{{- with $title }}<figcaption>{{ . }}</figcaption>{{ end }}
|
||||
</figure>
|
||||
{{- else }}
|
||||
<img src="{{ $imgPath | safeURL }}" alt="{{ $alt }}" title="{{ $title }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
22
themes/default/layouts/_default/_markup/render-link.html
Normal file
22
themes/default/layouts/_default/_markup/render-link.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{- $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 -}}
|
||||
<a href="{{ $newURL }}" title="{{ .Title }}"
|
||||
{{- if $isExternal -}} rel="noreferrer" class="external-link{{ if $isAffiliated }} affiliated{{ end }}{{ if $isExternal }} external{{ end }}" {{- end -}}>
|
||||
{{- .Text | safeHTML -}}
|
||||
</a>
|
||||
13
themes/default/layouts/_default/baseof.html
Normal file
13
themes/default/layouts/_default/baseof.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ site.Language.LanguageCode }}" dir="{{ or site.Language.LanguageDirection `ltr` }}">
|
||||
<head>
|
||||
{{ partial "head.html" . }}
|
||||
</head>
|
||||
<body>
|
||||
{{- block "main" . -}}{{- end }}
|
||||
|
||||
<footer>
|
||||
{{ partial "footer.html" . }}
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
24
themes/default/layouts/_default/home.html
Normal file
24
themes/default/layouts/_default/home.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{{- define "main" }}
|
||||
<main>
|
||||
<section id="hero">
|
||||
{{ $logo := resources.GetMatch "logo-large.png" -}}
|
||||
{{- with $logo.Resize "x256" -}}
|
||||
<img src="{{ .RelPermalink }}" alt="Logo" class="site-logo" />
|
||||
{{- end }}
|
||||
|
||||
<div>
|
||||
{{ .Content -}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="articles-list">
|
||||
{{- $pages := site.RegularPages -}}
|
||||
{{- $paginator := .Paginate $pages.ByDate.Reverse 12 -}}
|
||||
{{- $context := . -}}
|
||||
{{- $context.Scratch.Set "paginationPosition" "up" -}}
|
||||
{{- $context.Scratch.Set "paginator" $paginator -}}
|
||||
{{ partial "articles-list.html" (dict "Pages" $paginator.Pages "Context" $context) -}}
|
||||
{{ partial "pagination.html" $context -}}
|
||||
</section>
|
||||
</main>
|
||||
{{- end }}
|
||||
16
themes/default/layouts/_default/list.html
Normal file
16
themes/default/layouts/_default/list.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{ define "main" }}
|
||||
<main>
|
||||
{{- partial "header.html" . }}
|
||||
{{ .Content }}
|
||||
<section class="articles-list">
|
||||
{{ $pages := .Pages -}}
|
||||
{{- $paginator := .Paginate $pages.ByDate.Reverse 12 -}}
|
||||
{{- $context := . -}}
|
||||
{{- $context.Scratch.Set "paginationPosition" "up" -}}
|
||||
{{- $context.Scratch.Set "paginator" $paginator -}}
|
||||
{{ partial "articles-list.html" (dict "Pages" $paginator.Pages "Context" $context) -}}
|
||||
{{ partial "pagination.html" $context -}}
|
||||
</section>
|
||||
</main>
|
||||
{{ end }}
|
||||
|
||||
110
themes/default/layouts/_default/single.html
Normal file
110
themes/default/layouts/_default/single.html
Normal file
@@ -0,0 +1,110 @@
|
||||
{{ define "main" }}
|
||||
<main>
|
||||
<article>
|
||||
{{ partial "header.html" . -}}
|
||||
{{- $isLiens := eq .Parent.Title "Liens intéressants" -}}
|
||||
{{- $mtop := cond $isLiens "0" "2rem" -}}
|
||||
|
||||
{{- $coverPath := .Params.cover -}}
|
||||
{{- $img := false -}}
|
||||
{{- $coverData := dict -}}
|
||||
{{- if $coverPath -}}
|
||||
{{- $img = .Resources.GetMatch $coverPath -}}
|
||||
{{- if $img }}
|
||||
{{- $mtop = cond $isLiens "0" "100vh" -}}
|
||||
|
||||
{{/* Traitement YAML associé à l’image de couverture */}}
|
||||
{{- $basename := path.Base $coverPath -}}
|
||||
{{- $filename := replaceRE "\\.[^.]+$" "" $basename -}}
|
||||
{{- $yamlPath := printf "data/images/%s.yaml" $filename -}}
|
||||
{{- $yamlFile := .Resources.GetMatch $yamlPath -}}
|
||||
|
||||
{{- with $yamlFile }}
|
||||
{{- $yamlContent := .Content -}}
|
||||
{{- $coverData = $yamlContent | transform.Unmarshal -}}
|
||||
{{- end }}
|
||||
|
||||
<div class="article-hero {{ if $isLiens }}blurred-cover{{ end }}"
|
||||
style="background-image: url('{{ $img.RelPermalink }}');">
|
||||
{{ if $coverData.attribution }}
|
||||
<div class="image-attribution">
|
||||
<span>Attribution :</span>
|
||||
{{ $coverData.attribution | markdownify }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div id="article-backdrop"></div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- $context := . -}}
|
||||
{{- $context.Scratch.Set "paginationPosition" "down" -}}
|
||||
|
||||
<section class="articles-list">
|
||||
{{- partial "dossier-summary" . -}}
|
||||
</section>
|
||||
|
||||
<div class="article-content numbered-headings" style="margin-top: {{ $mtop }}">
|
||||
{{- if $isLiens }}
|
||||
{{- with .Params.links }}
|
||||
<div class="external-links-block" style="margin-top: 2rem; text-align: center;">
|
||||
{{- range . }}
|
||||
{{- if eq .name "Page d'origine" }}
|
||||
<a class="external-link" href="{{ .url }}" target="_blank" rel="noopener">
|
||||
Visiter le site
|
||||
</a>
|
||||
{{- else if eq .name "Lien archivé" }}
|
||||
<a class="archive-link" href="{{ .url }}" target="_blank" rel="noopener">
|
||||
Voir sur archive.org
|
||||
</a>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
{{ if and $img (gt (len $coverData) 0) }}
|
||||
<aside class="image-info-block" aria-labelledby="image-info-title">
|
||||
<h2>Image d'en-tête</h2>
|
||||
{{ with $coverData.title }}
|
||||
<h3 id="image-info-title">{{ . | markdownify }}</h3>
|
||||
{{ end }}
|
||||
|
||||
{{ $resized := $img.Resize "800x" }}
|
||||
<figure class="image-inline">
|
||||
<a href="{{ $img.RelPermalink }}" title="Cliquez pour agrandir l'image">
|
||||
<img src="{{ $resized.RelPermalink }}" alt="{{ $coverData.title }}" title="{{ $coverData.title }}" />
|
||||
</a>
|
||||
</figure>
|
||||
|
||||
{{ with $coverData.description }}
|
||||
<section class="image-description">
|
||||
<h3>Description</h3>
|
||||
<p>{{ . }}</p>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ with $coverData.prompt }}
|
||||
<section class="image-prompt">
|
||||
<h3>Prompt de génération IA</h3>
|
||||
<blockquote>{{ . }}</blockquote>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ with $coverData.attribution }}
|
||||
<footer>
|
||||
<p><strong>Attribution :</strong> {{ . | markdownify }}</p>
|
||||
</footer>
|
||||
{{ end }}
|
||||
</aside>
|
||||
{{ end }}
|
||||
|
||||
{{- $context.Scratch.Set "paginationPosition" "up" -}}
|
||||
<section class="articles-list">
|
||||
{{- partial "dossier-summary" . -}}
|
||||
</section>
|
||||
</article>
|
||||
</main>
|
||||
{{ end }}
|
||||
12
themes/default/layouts/_default/timeline.html
Normal file
12
themes/default/layouts/_default/timeline.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{ define "main" }}
|
||||
<main>
|
||||
<article>
|
||||
{{- partial "header.html" . }}
|
||||
<div class="article-content-wrapper">
|
||||
<div class="article-content">
|
||||
{{ partial "timeline.html" . }}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</main>
|
||||
{{ end }}
|
||||
62
themes/default/layouts/partials/articles-list.html
Normal file
62
themes/default/layouts/partials/articles-list.html
Normal file
@@ -0,0 +1,62 @@
|
||||
{{- $pages := .Pages -}}
|
||||
{{- $context := .Context -}}
|
||||
<div class="articles-grid">
|
||||
{{ range $pages -}}
|
||||
<a href="{{ .RelPermalink }}" class="article-card">
|
||||
{{ $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 := .Resize "650x" -}}
|
||||
<div class="article-image" style="background-image: url('{{ $resized.RelPermalink }}');">
|
||||
{{ with $page.Params.date -}}
|
||||
<span class="article-date">{{ $page.Date | time.Format ":date_long" }}</span>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{ end -}}
|
||||
{{- else -}}
|
||||
<div class="article-image" style="background: linear-gradient(135deg, #222 0%, #111 100%);">
|
||||
{{ with $page.Params.date -}}
|
||||
<span class="article-date">{{ $page.Date | time.Format ":date_long" }}</span>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
<div class="article-content">
|
||||
<h3 class="article-title">{{ .Title }}</h3>
|
||||
<div class="article-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>
|
||||
{{ end }}
|
||||
</div>
|
||||
53
themes/default/layouts/partials/dossier-summary.html
Normal file
53
themes/default/layouts/partials/dossier-summary.html
Normal 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) }}
|
||||
|
||||
<nav class="pagination-bar dossier-pagination {{ $position }}">
|
||||
<h2>{{ $dossierID }}</h2>
|
||||
|
||||
{{- if ge $index 1 }}
|
||||
<a class="prev-page" href="{{ $prev.RelPermalink }}">← Page précédente</a>
|
||||
{{- else }}
|
||||
<span class="disabled prev-page">← Page précédente</span>
|
||||
{{- end }}
|
||||
|
||||
<details class="page-select {{ $position }}">
|
||||
<summary>{{ $currentTitle }}</summary>
|
||||
<ul>
|
||||
{{- 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-page" href="{{ $next.RelPermalink }}">Page suivante →</a>
|
||||
{{- else }}
|
||||
<span class="disabled next-page">Page suivante →</span>
|
||||
{{- end }}
|
||||
</nav>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
4
themes/default/layouts/partials/footer.html
Normal file
4
themes/default/layouts/partials/footer.html
Normal file
@@ -0,0 +1,4 @@
|
||||
{{ partial "footer/nav.html" . }}
|
||||
|
||||
<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>
|
||||
22
themes/default/layouts/partials/footer/nav.html
Normal file
22
themes/default/layouts/partials/footer/nav.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<nav>
|
||||
<ul>
|
||||
{{ range site.Menus.main -}}
|
||||
{{- if .HasChildren -}}
|
||||
<li>
|
||||
<a href="{{ .PageRef }}" title="{{ .Title }}">{{ .Name }}</a>
|
||||
<ul>
|
||||
{{ range .Children -}}
|
||||
<li>
|
||||
<a href="{{ .PageRef }}">{{ .Name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
{{- else -}}
|
||||
<li>
|
||||
<a href="{{ .PageRef }}" title="{{ .Title }}">{{ .Name }}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
10
themes/default/layouts/partials/head.html
Normal file
10
themes/default/layouts/partials/head.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
||||
|
||||
{{- partial "head/css.html" . }}
|
||||
|
||||
{{ with .Site.Params.favicon -}}
|
||||
<link rel="icon" href="{{ . }}" type="image/png" />
|
||||
{{- end }}
|
||||
11
themes/default/layouts/partials/head/css.html
Normal file
11
themes/default/layouts/partials/head/css.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{ $sectionSource := resources.Get "css/generated/sections-colors.css" -}}
|
||||
{{- $sectionCSS := $sectionSource | resources.ExecuteAsTemplate "css/generated/sections-colors.css" . -}}
|
||||
{{- $mainCSS := resources.Get "css/main.css" | postCSS (dict "inlineImports" true) -}}
|
||||
{{- $bundle := slice $sectionCSS $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 -}}
|
||||
45
themes/default/layouts/partials/header.html
Normal file
45
themes/default/layouts/partials/header.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<header>
|
||||
{{ $logo := resources.GetMatch "logo-large.png" }}
|
||||
{{ with $logo.Resize "x120" }}
|
||||
<img src="{{ .RelPermalink }}" alt="Logo" class="site-logo" />
|
||||
{{ end }}
|
||||
<div class="header-content">
|
||||
<h1 class="page-title">{{ .Title }}</h1>
|
||||
<div class="page-meta">
|
||||
{{ with .Date }}
|
||||
<time datetime="{{ . }}">{{ . | time.Format ":date_long" }}</time>
|
||||
{{ end }}
|
||||
{{ $section := "" -}}
|
||||
{{- with .Parent -}}
|
||||
{{- $sectionPath := path.Base .File.Dir -}}
|
||||
{{- $section = $sectionPath -}}
|
||||
{{- end -}}
|
||||
<span class="section section-{{ $section }}">{{ .Parent.LinkTitle }}</span>
|
||||
{{- if ge .ReadingTime 5 -}}
|
||||
{{- .ReadingTime }} min de lecture
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="tablet-header">
|
||||
{{ $logo := resources.GetMatch "logo-large.png" }}
|
||||
{{ with $logo.Resize "x32" }}
|
||||
<img src="{{ .RelPermalink }}" alt="Logo réduit" class="tablet-logo" />
|
||||
{{ end }}
|
||||
<span class="tablet-title">{{ .Title }}</span>
|
||||
<div class="tablet-links">
|
||||
<a href="/" title="Retour à la page d'accueil du site">⌂</a>
|
||||
{{ if and (.Parent) (ne .Parent.RelPermalink "/") }}
|
||||
<a href="{{ .Parent.RelPermalink }}" title="Retour à la section parente">↰</a>
|
||||
{{ end }}
|
||||
|
||||
{{ with .TableOfContents }}
|
||||
{{ if gt (len (plainify .)) 0 }}
|
||||
<details id="toc" title="Table des matières">
|
||||
<summary>☰</summary>
|
||||
{{ . | safeHTML }}
|
||||
</details>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
33
themes/default/layouts/partials/pagination.html
Normal file
33
themes/default/layouts/partials/pagination.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{{- $paginator := .Scratch.Get "paginator" -}}
|
||||
{{- if $paginator -}}
|
||||
{{- if gt $paginator.TotalPages 1 -}}
|
||||
<nav class="pagination-bar {{ .Scratch.Get "paginationPosition" }}">
|
||||
{{ with $paginator.Prev -}}
|
||||
<a class="prev-page" href="{{ .URL }}">← Page précédente</a>
|
||||
{{- else -}}
|
||||
<span class="disabled prev-page">← Page précédente</span>
|
||||
{{- end }}
|
||||
|
||||
<details class="page-select {{ .Scratch.Get "paginationPosition" }}">
|
||||
<summary>Page {{ $paginator.PageNumber }} / {{ $paginator.TotalPages }}</summary>
|
||||
<ul>
|
||||
{{- range $paginator.Pagers }}
|
||||
<li>
|
||||
{{- if eq .PageNumber $paginator.PageNumber -}}
|
||||
<span class="current">{{ .PageNumber }}</span>
|
||||
{{- else -}}
|
||||
<a href="{{ .URL }}">{{ .PageNumber }}</a>
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
{{ with $paginator.Next -}}
|
||||
<a class="next-page" href="{{ .URL }}">Page suivante →</a>
|
||||
{{- else -}}
|
||||
<span class="disabled next-page">Page suivante →</span>
|
||||
{{- end }}
|
||||
</nav>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
80
themes/default/layouts/partials/timeline.html
Normal file
80
themes/default/layouts/partials/timeline.html
Normal file
@@ -0,0 +1,80 @@
|
||||
{{/* Partial : timeline.html */}}
|
||||
|
||||
{{- $pages := sort site.RegularPages "Date" -}}
|
||||
{{- $entries := slice -}}
|
||||
{{- range $pages -}}
|
||||
{{- if ne (.Date.Format "2006-01-02") "0001-01-01" -}}
|
||||
{{- $entries = $entries | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $grouped := dict -}}
|
||||
{{- range $entries -}}
|
||||
{{- $year := printf "%d" .Date.Year -}}
|
||||
{{- $month := printf "%02d" .Date.Month -}}
|
||||
{{- $day := printf "%02d" .Date.Day -}}
|
||||
{{- $y := index $grouped $year | default dict -}}
|
||||
{{- $m := index $y $month | default dict -}}
|
||||
{{- $d := index $m $day | default slice -}}
|
||||
{{- $d = $d | append . -}}
|
||||
{{- $m = merge $m (dict $day $d) -}}
|
||||
{{- $y = merge $y (dict $month $m) -}}
|
||||
{{- $grouped = merge $grouped (dict $year $y) -}}
|
||||
{{- end -}}
|
||||
|
||||
<div class="timeline">
|
||||
<div class="list">
|
||||
{{- $years := slice -}}
|
||||
{{- range $yKey, $_ := $grouped -}}
|
||||
{{- $years = $years | append $yKey -}}
|
||||
{{- end -}}
|
||||
{{- range sort $years -}}
|
||||
{{- $yKey := . -}}
|
||||
{{- $months := index $grouped $yKey -}}
|
||||
<div class="year">
|
||||
<span>{{- $yKey -}}</span>
|
||||
<div class="list">
|
||||
{{- $monthKeys := slice -}}
|
||||
{{- range $mKey, $_ := $months -}}
|
||||
{{- if ne $mKey "" -}}
|
||||
{{- $monthKeys = $monthKeys | append $mKey -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- range sort $monthKeys -}}
|
||||
{{- $mKey := . -}}
|
||||
{{- $mKeyTrimmed := replaceRE "^0+" "" $mKey -}}
|
||||
{{- $mKeyInt := cond (eq $mKeyTrimmed "") 1 (int $mKeyTrimmed) -}}
|
||||
{{- $days := index $months $mKey -}}
|
||||
<div class="month">
|
||||
<span>{{- index (slice "janvier" "février" "mars" "avril" "mai" "juin" "juillet" "août" "septembre" "octobre" "novembre" "décembre") (sub $mKeyInt 1) -}}</span>
|
||||
<div class="list">
|
||||
{{- $dayKeys := slice -}}
|
||||
{{- range $dKey, $_ := $days -}}
|
||||
{{- if ne $dKey "" -}}
|
||||
{{- $dayKeys = $dayKeys | append $dKey -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- range sort $dayKeys -}}
|
||||
{{- $dKey := . -}}
|
||||
{{- $articles := index $days $dKey -}}
|
||||
<div class="day">
|
||||
<span>{{- $dKey -}}</span>
|
||||
<ul class="list">
|
||||
{{- range $articles -}}
|
||||
<li>
|
||||
<a href="{{- .RelPermalink -}}">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
30
themes/default/layouts/shortcodes/extimage.html
Normal file
30
themes/default/layouts/shortcodes/extimage.html
Normal 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>
|
||||
0
themes/default/layouts/shortcodes/sound.html
Normal file
0
themes/default/layouts/shortcodes/sound.html
Normal file
44
themes/default/layouts/shortcodes/video.html
Normal file
44
themes/default/layouts/shortcodes/video.html
Normal 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 -}}
|
||||
Reference in New Issue
Block a user