bglug.it/layouts/_default/single.html
paspo 888aaedb58 fix singleview con featured svg (#102)
Reviewed-on: BgLUG/bglug.it#102
Co-authored-by: paspo <paolo@asperti.com>
Co-committed-by: paspo <paolo@asperti.com>
2024-07-14 09:16:04 +00:00

39 lines
1.3 KiB
HTML

{{ define "main" }}
<header>
<h2>{{ .Title }}</h2>
<p>{{ .Description }}</p>
{{ if .Site.Params.show_post_dates | default true }}
{{- with .Date }}<time>{{ . | time.Format ":date_medium" }}</time>{{ end }}
{{ end }}
{{ partial "tags.html" . }}
</header>
{{- if or .Params.image .Params.featured }}
{{- $maxHeight := 600 -}}
{{ $rasters := slice "jpeg" "png" }}
{{- $img := "#" -}}
{{- if .Params.image -}}
{{/* se è stata definita un'immagine featured */}}
{{- $img = .Page.Resources.GetMatch .Params.image -}}
{{- end -}}
{{- if .Params.featured -}}
{{/* se è stata definita un'immagine featured */}}
{{- $img = .Page.Resources.GetMatch .Params.featured -}}
{{- end -}}
<span class="image featured">
{{- if in $rasters $img.MediaType.SubType -}}
{{- $img = $img.Resize (printf "x%d" $maxHeight) -}}
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" style="width: {{ $img.Width }}px; max-height: {{ $maxHeight }}px;" />
{{ else }}
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" style="max-height: {{ $maxHeight }}px;" />
{{ end }}
</span>
{{ end }}
{{- .Content }}
{{ end }}