{{ define "main" }}
    {{ $paginator := .Paginate ( where site.RegularPages "Type" "in" site.Params.mainSections ) }}
    {{ if ne .Kind "home" }}
        {{ $paginator = .Data }}
    {{ end }}
    <div class="row grid" data-masonry='{ "itemSelector": ".grid-item" }' style="margin-top: 25%">
        <div class="columns"></div>

        {{ range $paginator.Pages }}
            <div class="five columns grid-item">
                {{ range .Params.categories }}
                    <a href="{{ $.Site.BaseURL }}categories/{{ . | urlize }}/">{{ . }}</a>
                {{ end }}
                <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
                {{ if ne .Kind "term" }}
                    <p class="date">{{.Date.Format "January 2, 2006"}}</p>
                {{ end }}
                <p class="summary">{{ .Summary | plainify | htmlUnescape }}</p>
                <p>
                    {{ range .Params.tags }}
                    <a href="{{ $.Site.BaseURL }}tags/{{ . | urlize }}/">#{{ . }}</a>
                    {{ end }}                              
                </p>
            </div>
        {{ end }}
    </div>

    {{- partial "pagination.html" . -}}

    <script src="/js/masonry.js"></script>
{{ end }}