{{ define "main" }}
{{ if .Data.Singular }}
<h3>Filtering for "{{ .Title }}"</h3>
<small>
    <a href="{{ . | relURL }}">Remove filter</a>
</small>
{{ else }}
<h1>{{ .Title | markdownify }}</h1>
{{ end }}

{{ range .Paginator.Pages }}
<div class="post">
    <h2 class="post-title">
        <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
    </h2>

    {{ if or .Date (.GetTerms "tags") }}
    <div class="post-metadata">
        {{ if .Date }}
        <time datetime="{{ .Date.Format "January 2, 2006" }}" pubdate>
            {{ .Date.Format "January 2, 2006" }}
        </time>
        {{ if ne .Lastmod .Date }}
        <time datetime="{{ .Lastmod.Format "2006-01-02" }}" pubdate>
            (Modified {{ .Lastmod.Format "January 2, 2006" }})
        </time>
        {{ end }}
        {{ end }}

        <span class="tags">
            {{ range (.GetTerms "tags") }}
            <a href="{{ .Permalink }}">#{{ .LinkTitle }}</a>
            {{ end }}
        </span>
    </div>
    {{ end }}

    <div class="post-description">
        {{ if .Description }}
        {{ .Description | markdownify }}
        {{ else }}
        {{ .Summary | markdownify }}
        {{ end }}
    </div>

    <div class="readmore">
        <a href="{{ .Permalink }}">Read more &rarr;</a>
    </div>
</div>
{{ else }}
<div>
    No posts here!
</div>
{{ end }}

<div class="pagination">
    {{ template "_internal/pagination.html" . }}
</div>

{{ end }}