63 lines
1.9 KiB
HTML
63 lines
1.9 KiB
HTML
{{ define "main" }}
|
||
{{- $bundle := . -}}
|
||
{{- if .IsSection }}
|
||
{{- $bundle = site.GetPage .Path -}} {{/* Récupère la section active proprement */}}
|
||
{{- end }}
|
||
|
||
<main>
|
||
{{- partial "header.html" . }}
|
||
|
||
<article>
|
||
{{- $coverPath := $bundle.Params.cover -}}
|
||
{{- $mtop := "2rem" -}}
|
||
{{- $img := false -}}
|
||
{{- $coverData := dict -}}
|
||
|
||
{{- if $coverPath -}}
|
||
{{- $img = $bundle.Resources.GetMatch $coverPath -}}
|
||
{{- if $img }}
|
||
{{- $mtop = "100vh" -}}
|
||
|
||
{{/* Traitement YAML compagnon de l’image */}}
|
||
{{- $basename := path.Base $coverPath -}}
|
||
{{- $filename := replaceRE "\\.[^.]+$" "" $basename -}}
|
||
{{- $yamlPath := printf "data/images/%s.yaml" $filename -}}
|
||
{{- $yamlFile := $bundle.Resources.GetMatch $yamlPath -}}
|
||
|
||
{{- with $yamlFile }}
|
||
{{- $coverData = .Content | transform.Unmarshal -}}
|
||
{{- end }}
|
||
|
||
<div class="article-hero" 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 }}
|
||
|
||
{{- if $bundle.Content }}
|
||
<div class="article-content" style="margin-top: {{ $mtop }}">
|
||
{{ $bundle.Content }}
|
||
</div>
|
||
{{- end }}
|
||
</article>
|
||
|
||
<section class="articles-list">
|
||
{{- $pages := .Pages -}}
|
||
{{- $paginator := .Paginate $pages.ByDate.Reverse 12 -}}
|
||
{{- $context := . -}}
|
||
{{- $context.Scratch.Set "paginationPosition" "down" -}}
|
||
{{- $context.Scratch.Set "paginator" $paginator -}}
|
||
{{- partial "pagination.html" $context -}}
|
||
{{- partial "articles-list.html" (dict "Pages" $paginator.Pages "Context" $context) -}}
|
||
{{- $context.Scratch.Set "paginationPosition" "up" -}}
|
||
{{- $context.Scratch.Set "paginator" $paginator -}}
|
||
{{- partial "pagination.html" $context -}}
|
||
</section>
|
||
</main>
|
||
{{ end }} |