Lego2012
6/12/2017 - 7:51 PM

summary-with-image.html Example

summary-with-image.html Example

{{ $featured_image := .Params.featured_image }}
<article>
    <a href="{{ .URL }}">
        <div>
            {{ if .Params.featured_image }}
                {{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
                {{ $featured_image := (trim $featured_image "/") | absURL }}
                <div>
                    <img src="{{ $featured_image }}" alt="image from {{ .Title }}">
                </div>
            {{ end }}
            <div class="{{ if .Params.featured_image }} w-60-ns{{ end }}">
                <h1>{{ .Title }}</h1>
                <div>
                    {{ .Summary }}
                </div>
                {{/* TODO: add author
                <p>By {{ .Author }}</p> */}}
            </div>
        </div>
    </a>
</article>