{{- $imgPath := (urls.Parse .Destination).Path -}} {{- $imgName := path.Base $imgPath | replaceRE "\\.[^.]+$" "" -}} {{/* Supprime l'extension */}} {{- $dataPath := printf "data/images/%s.yaml" $imgName -}} {{- $dataFile := .Page.Resources.Get $dataPath -}} {{- $data := dict -}} {{- if $dataFile }} {{- with $dataFile.Content | transform.Unmarshal -}} {{- $data = . -}} {{- end -}} {{- end }} {{- $alt := .PlainText | default $data.title | default "" -}} {{- $title := .Title | default $data.title | default .Page.Title -}} {{- $description := default $data.description | default $title -}} {{- $image := false -}} {{- $imagePathLower := lower $imgPath -}} {{- if or (strings.HasSuffix $imagePathLower ".yaml") (strings.HasSuffix $imagePathLower ".yml") -}} {{- $imageDataFile := .Page.Resources.Get $imgPath -}} {{- if $imageDataFile -}} {{- with $imageDataFile.Content | transform.Unmarshal -}} {{- with index . "file" -}} {{- $imageFilePath := strings.TrimSpace (printf "%v" .) -}} {{- if ne $imageFilePath "" -}} {{- $image = $.Page.Resources.Get $imageFilePath -}} {{- end -}} {{- end -}} {{- end -}} {{- end -}} {{- else -}} {{- $image = .Page.Resources.Get $imgPath -}} {{- end -}} {{- with $image -}} {{- $resolvedImage := . -}} {{- $display := $resolvedImage }} {{- if and $display (ne $display.MediaType.SubType "svg") (gt $display.Height 810) }} {{- $display = $resolvedImage.Resize "x810" -}} {{- end }}
{{- with $description }}

{{ . | markdownify }}

{{- end }} {{ $alt }} {{- if $data.prompt }}
Attribution : {{- with $data.attribution }} {{ . | markdownify }}{{- end }}

Prompt : {{ $data.prompt }}

{{- else }} {{- with $data.attribution }}

Attribution : {{ . | markdownify }}

{{- end }} {{- end }}
{{- end -}}