{{ partial "core/html-start.html" . }}
{{ partial "core/head.html" . }}

<body>
    {{ partial "core/main-menu.html" . }}

    {{ $sp := .Site.Params }}
    {{ if and (isset $sp "Post") (isset $sp.Post "infinite_scroll") }}
        {{ with $sp.Post.infinite_scroll }}
            {{ $.Scratch.Set "infinite_scroll" (eq . true) }}
        {{ end }}
    {{ else }}
        {{ $.Scratch.Set "infinite_scroll" false }}
    {{ end }}

    {{ if eq ($.Scratch.Get "infinite_scroll") false }}
        {{ with $sp.infinite_scroll }}
            {{ $.Scratch.Set "infinite_scroll" (eq . true) }}
        {{ else }}
            {{ $.Scratch.Set "infinite_scroll" false }}
        {{ end }}
    {{ end }}

    {{ $infinite_scroll := $.Scratch.Get "infinite_scroll" }}

    <section class="main-content">
        <div class="masonry-flex-container {{ if $infinite_scroll }}infinite-scroll{{ end }}">
            {{ if .IsNode }}
                {{ range .Paginator.Pages }}
                    <div class="flex-item">
                        {{ partial "post/page-item.html" . }}
                    </div>
                {{ end }}
            {{ end }}
        </div>
        {{ partial "extra/pagination.html" . }}
    </section>

    {{ partial "core/js.html" . }}
</body>

{{ partial "core/html-end.html" . }}

