Initial commit
This commit is contained in:
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>
|
||||
Reference in New Issue
Block a user