42 lines
1.5 KiB
HTML
42 lines
1.5 KiB
HTML
{{- $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 and $display (ne $display.MediaType.SubType "svg") (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>
|