Some checks are pending
Container Publish / build-image (push) Waiting to run
ho messo le didascalie solo in [questa pagina](http://localhost:1313/it/linuxday/2023/linux-day-2023-agenda/) per ora. Viene circa così:   Reviewed-on: #156 Co-authored-by: paspo <paolo@asperti.com> Co-committed-by: paspo <paolo@asperti.com>
37 lines
1.1 KiB
HTML
37 lines
1.1 KiB
HTML
<figure>
|
|
{{- $u := urls.Parse .Destination -}}
|
|
{{- $src := $u.String -}}
|
|
{{- $figcaption := .Title | markdownify -}}
|
|
{{- $captionWidth := 0 -}}
|
|
{{- if not $u.IsAbs -}}
|
|
{{- $path := strings.TrimPrefix "./" $u.Path }}
|
|
{{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
|
|
{{- if gt .Width 1400 -}}
|
|
{{- $src = (.Resize "1400x webp q50").RelPermalink -}}
|
|
{{- else -}}
|
|
{{- $src = (.Process "webp q50").RelPermalink -}}
|
|
{{- end -}}
|
|
{{- with $u.RawQuery -}}
|
|
{{- $src = printf "%s?%s" $src . -}}
|
|
{{- end -}}
|
|
{{- with $u.Fragment -}}
|
|
{{- $src = printf "%s#%s" $src . -}}
|
|
{{- end -}}
|
|
{{- $captionWidth = .Width -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- $attributes := merge .Attributes (dict "alt" .Text "src" $src "title" (.Title | transform.HTMLEscape)) -}}
|
|
<img
|
|
{{- range $k, $v := $attributes -}}
|
|
{{- if $v -}}
|
|
{{- printf " %s=%q" $k $v | safeHTMLAttr -}}
|
|
{{- end -}}
|
|
{{- end -}}>
|
|
{{- with $figcaption -}}
|
|
<figcaption
|
|
{{ with $captionWidth }} style="width: {{- . -}}px;"
|
|
{{- end -}}>{{- . -}}</figcaption>
|
|
{{- end -}}
|
|
</figure>
|
|
{{- /**/ -}}
|