{{ define "main" }}
<main>

    <h1 class="page-title">{{ .Title }}</h1>

    {{ if default true .Site.Params.showTaxonomyLinks }}
    <div class="taxonomy-links">
        <ul>
            {{- /* code for figuring out where to archives page is, if anywhere */ -}}
            {{ $archivesExists := false }}
            {{ $archivesPageTitle := "" }}
            {{ $archivesPagePermalink := "" }}
            {{ range .Site.AllPages }}
                {{ if eq .Layout "archives" }}
                    {{ $archivesExists = true }}
                    {{ $archivesPagePermalink = .Permalink }}
                    {{ with .Title }}
                        {{ $archivesPageTitle = . }}
                    {{ end }}
                {{ end }}
            {{ end }}
            {{ if $archivesExists }}
            <li><a href="{{ $archivesPagePermalink }}">{{ default "Archives" $archivesPageTitle }}</a></li>
            {{ end }}

            {{ range $taxonomyName, $taxonomy := .Site.Taxonomies }}
                {{ if or (in $taxonomyName "categ") (in $taxonomyName "tag") }}
            <li><a href="{{ $taxonomyName | absURL }}">{{ $taxonomyName }}</a></li>
                {{ end }}
            {{ end }}
        </ul>
    </div>
    {{ end }}

    {{- if .Pages -}}
        {{- $pages := (where .Pages ".Draft" false) -}}

        {{- /* Use site config params for posts per page if available, otherwise default */ -}}
        {{- with .Site.Params.list.paginate | default .Site.Params.paginate -}}
            {{- $pages = $.Paginate $pages . -}}
        {{- else -}}
            {{- $pages = .Paginate $pages -}}
        {{- end -}}

        {{- range $pages.Pages -}}
            {{ partial "blog-entry-summary.html" . }}
        {{- end -}}

        {{ partial "pagination.html" . }}
    {{- end -}}
</main>
{{ end }}
