{{ define "main" }}
    {{ $paginator := .Paginate .Data.Pages }}

    <main class="posts">
        <h1>{{ .Title }}</h1>
        {{ if .Params.subtitle }}
        <strong>{{ .Params.subtitle | markdownify }}</strong>
        {{ end }}

        {{ if .Content }}
            <div class="content">{{ .Content }}</div>
        {{ end }}

        {{ range $paginator.Pages.GroupByDate "2006" }}
            <div class="posts-group">
                <div class="post-year">{{ .Key }}</div>

                <ul class="posts-list">
                    {{ range .Pages }}
                        <li class="post-item">
                            <a href="{{.Permalink}}" class="post-item-inner">
                                <span class="post-title">
                                    {{ if or .Params.pinned (eq (.Title | title) "Pinned") }}
                                        <img style="display: inline-block; vertical-align: middle; margin-right: 4px;"
                                            src="/feathericons/16px-a9a9b3/paperclip.svg" alt="Pinned:"
                                        >
                                    {{ end }}
                                    {{ if .Params.tags }}{{ index .Params.tags 0 | title }}:{{ end }}
                                    {{ .Title }}{{ if and (.Params.subtitle) (and (.Params.author) (.Params.date)) }}
                                        {{ "--" | markdownify }} {{ .Params.subtitle}}
                                    {{ end }}
                                </span>
                                <span class="post-day">
                                    {{ if .Site.Params.dateformShort }}
                                        {{ time.Format .Site.Params.dateformShort .Date }}
                                    {{ else }}
                                        {{ time.Format "Jan 2" .Date }}
                                    {{ end }}
                                </span>
                            </a>
                        </li>
                    {{ end }}
                </ul>
            </div>
        {{ end }}
    {{ partial "pagination-list.html" . }}
    </main>
{{ end }}
