52 lines
2.0 KiB
HTML
52 lines
2.0 KiB
HTML
{{- $imgPath := .Destination -}}
|
|
{{- $imgName := path.Base $imgPath | replaceRE "\\.[^.]+$" "" -}}
|
|
{{- $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 := $data.description | default "" -}}
|
|
{{- $image := .Page.Resources.GetMatch $imgPath -}}
|
|
{{- if not $image -}}
|
|
{{- return -}}
|
|
{{- end -}}
|
|
{{- $display := $image -}}
|
|
{{- if and (ne $display.MediaType.SubType "svg") (gt $display.Height 810) -}}
|
|
{{- $display = $image.Resize "x810" -}}
|
|
{{- end -}}
|
|
{{- $metaTitle := index $data "title" -}}
|
|
{{- $hasMeta := or $metaTitle (or $description (or $data.attribution $data.prompt)) -}}
|
|
<figure class="figure-media{{ if $hasMeta }} figure-media-with-meta{{ else }} figure-media-without-meta{{ end }}">
|
|
<a href="{{ $image.RelPermalink }}" title="Cliquez pour agrandir l'image">
|
|
<img src="{{ $display.RelPermalink }}" alt="{{ $alt }}" title="{{ $title }}">
|
|
</a>
|
|
{{- if $hasMeta -}}
|
|
<figcaption class="figure-media-meta cover-meta">
|
|
<div class="figure-media-meta-main">
|
|
{{- with $metaTitle -}}
|
|
<p class="figure-title cover-title">{{ . | markdownify }}</p>
|
|
{{- end -}}
|
|
{{- with $description -}}
|
|
<p class="figure-description cover-description">{{ . | markdownify }}</p>
|
|
{{- end -}}
|
|
</div>
|
|
{{- if or $data.attribution $data.prompt -}}
|
|
<div class="figure-media-meta-extra">
|
|
{{- with $data.attribution -}}
|
|
<p class="figure-attribution cover-attribution"><strong>Attribution :</strong> <span>{{ . | markdownify }}</span></p>
|
|
{{- end -}}
|
|
{{- with $data.prompt -}}
|
|
<details>
|
|
<summary>Prompt</summary>
|
|
<p>{{ . | markdownify }}</p>
|
|
</details>
|
|
{{- end -}}
|
|
</div>
|
|
{{- end -}}
|
|
</figcaption>
|
|
{{- end -}}
|
|
</figure>
|