40 lines
1.5 KiB
HTML
40 lines
1.5 KiB
HTML
{{- $imageURL := .Get 0 -}}
|
|
{{- $title := .Get 2 | default "" -}}
|
|
{{- $description := .Get 3 | default "" -}}
|
|
{{- $attribution := .Get 4 | default "" -}}
|
|
{{- $remoteURL := printf "%s?raw=true" $imageURL -}}
|
|
{{- $remoteImage := resources.GetRemote $remoteURL -}}
|
|
{{- $hash := md5 $remoteURL -}}
|
|
{{- $extension := path.Ext $remoteURL -}}
|
|
{{- $cleanFilename := printf "%s%s" $hash $extension | replace "?raw=true" "" -}}
|
|
{{- $localImage := $remoteImage | resources.Copy (printf "remote-images/%s" $cleanFilename) -}}
|
|
{{- $hasMeta := or $title (or $description $attribution) -}}
|
|
<figure class="figure-media{{ if $hasMeta }} figure-media-with-meta{{ else }} figure-media-without-meta{{ end }}">
|
|
<a href="{{ $localImage.RelPermalink }}" title="Cliquez pour agrandir l'image">
|
|
{{- partial "media/display-img.html" (dict
|
|
"image" $localImage
|
|
"showMeta" $hasMeta
|
|
"forceCentered" false
|
|
"alt" $title
|
|
"title" $title
|
|
) -}}
|
|
</a>
|
|
{{- if $hasMeta -}}
|
|
<figcaption class="figure-media-meta cover-meta">
|
|
<div class="figure-media-meta-main">
|
|
{{- with $title -}}
|
|
<p class="figure-title cover-title">{{ . | markdownify }}</p>
|
|
{{- end -}}
|
|
{{- with $description -}}
|
|
<p class="figure-description cover-description">{{ . | markdownify }}</p>
|
|
{{- end -}}
|
|
</div>
|
|
{{- with $attribution -}}
|
|
<div class="figure-media-meta-extra">
|
|
<p class="figure-attribution cover-attribution"><strong>Attribution :</strong> <span>{{ . | markdownify }}</span></p>
|
|
</div>
|
|
{{- end -}}
|
|
</figcaption>
|
|
{{- end -}}
|
|
</figure>
|