{{ define "main" }}

    {{/* get all the pages that are regular posts and not pages */}}
    {{ $postsDir := .Site.Params.Posts | default (slice "posts" "post") }}
    {{ $postsList := where .Site.RegularPages "Section" "in" $postsDir }}

    {{/* pagination */}}
    <div class="postlist {{ if .Site.Params.gridView }}gridView{{ end }}" id="postlist">
    {{ range (.Paginate $postsList).Pages }}
        <article class="card postlistitem {{ if .Site.Params.discreteCards }}discrete{{ end }}">
            <div>
                <h2>
                    <a href="{{ .Permalink }}">{{ .Title }}</a>
                </h2>
                <p class="date">
                <span title="Date"> </span>
                {{ .Date.Format "2006-01-02" }}
                {{ if .Params.tags }}
                    | <!-- Pipe character as visual separator between date and tags-->
                    <span title="Tags"> </span>
                    {{ range .Params.tags }}
                        <a href="/tags/{{ . }}">#{{ . }}</a>
                    {{ end }}
                {{ end }}
                </p>
                {{ if .Site.Params.imageInArticlePreview }}
                    {{ if .Params.Image }}
                        <img src="{{ .Params.Image }}" />
                    {{ end }}
                {{end}}
                <div class="articlePreview">
                    <p>{{ .Summary }}</p>
                    <p><a href="{{ .Permalink }}">Continue reading </a></p>
                </div>
            </div>
            <hr />
        </article>
    {{ end }}
    </div>
    <div id="getNextBtnContainer"></div>
    {{- partial "paginator.html" . -}}

{{ end }}