Introduction du nouveau thème
This commit is contained in:
41
themes/42/layouts/_partials/media/render-image.html
Normal file
41
themes/42/layouts/_partials/media/render-image.html
Normal file
@@ -0,0 +1,41 @@
|
||||
{{- $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 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>
|
||||
Reference in New Issue
Block a user