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 }}
|
||||
Reference in New Issue
Block a user