{{ define "main" }}
<h1>{{ .Page.Title }}</h1>
{{ .Content }}
<div class="image-grid">
    {{ range sort .Data.Pages "Date" "desc" }}
        {{ if and (isset .Params "image") .Params.image }}
            <a href="{{ .RelPermalink }}" title="{{ .Title }}">
            {{ $image := .Page.Resources.GetMatch .Params.image }}
            {{ with $image }}
                {{ $thumb := .Resize "600x" }}
                <img src="{{ $thumb.RelPermalink }}" alt="{{ .Title }}">
            {{end}}
            </a>
        {{ end }}
    {{ end }}
</div>
{{ end }}
