amreo 4ac390b86b
Some checks failed
Container Publish / build-image (push) Failing after 2m29s
Vulnerability Scan / Daily Vulnerability Scan (push) Failing after 5m15s
Aggiunto shortcode img per didascalie fatte meglio (#365)
Fixes #356

Co-authored-by: amreo <amreo0x+github@protonmail.com>
Co-authored-by: paspo <paolo@asperti.com>
Reviewed-on: #365
Reviewed-by: Paolo Asperti <paspo@noreply.libreschool.org>
2025-04-08 20:05:11 +00:00

26 lines
1.1 KiB
HTML

<div>
{{- $imgsrc := .Page.Resources.GetMatch (.Get "src") -}}
<img src="{{ $imgsrc.RelPermalink }}" alt="{{ .Get "alt" }}" title="{{ .Get "title" }}">
<figcaption>
{{ if strings.HasPrefix (.Get "source") "http" }}
<small class="image-source">🛈 {{ T "source" }}: <a href="{{ .Get "source" }}" target="_blank">{{ .Get "source" }}</a></small>
{{ else if ne (.Get "source") "" }}
<small class="image-source">🛈 {{ T "source" }}: {{ .Get "source" }}</small>
{{ end }}
{{ if ne (.Get "author") "" }}
<small class="image-source">🧑‍🎨 {{ T "author" }}: {{ .Get "author" }}</small>
{{ end }}
{{ if ne (.Get "license-text") "" }}
{{ if strings.HasPrefix (.Get "license-url") "http" }}
<small class="image-source">📄 {{ T "license" }}: <a href="{{ .Get "license-url" }}" target="_blank">{{ .Get "license-text" }}</a></small>
{{ else }}
<small class="image-source">📄 {{ T "license" }}: {{ .Get "license-text" }}</small>
{{ end }}
{{ end }}
</figcaption>
</div>