{{ 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 -}}
        {{- $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 -}}
        
        {{- $image := $img.Resize (printf "x%d" $maxHeight) -}}

        <span class="image featured">
            <img src="{{ $image.RelPermalink }}" alt="{{ .Params.image_alt }}" style="width: {{ $image.Width }}px; max-height: {{ $maxHeight }}px;" />
        </span>
    {{ end }}

    {{- .Content }}
{{ end }}