{{ $sp := .Site.Params }}
{{ if and (isset $sp "Project") (isset $sp.Project "infinite_scroll") }}
    {{ with $sp.Project.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" }}

<div class="masonry-flex-container {{ if $infinite_scroll }}infinite-scroll{{ end }}">
    {{ range .Paginator.Pages }}
        {{ partial "project/item.html" . }}
    {{ end }}
</div>

