List template (baseurl/posts/) page works fine, it displays few posts then there is a button to load-more (infinity-scroll script), then I can view more posts. Homepage doesn’t display any list of posts. It can not see any posts.
index.html template (code redacted):
{{- partial "pagination.html" . -}}
partials/pagination.html:
<section>
<div class="latest-posts-section">
<div class="loop-wrap">
{{ $paginator := .Paginate (where .Pages "Type" "in" site.Params.mainSections) }}
{{ if $paginator }}
{{- range $paginator.Pages -}}
{{ partial "post-card.html" . }}
{{ end }}
</div>
<div class="break"></div>
{{ if gt (len (where .Pages "Type" "in" site.Params.mainSections )) 6 }}
<div class="pagination">
{{ with $paginator }}
<a href="/posts/page/2/" aria-label="Load more" style="display: none;"></a>
<button class="button-primary">Load more</button>
{{ end }}
</div>
{{ end }}
{{ end }}
</div>
</section>
Now, I have weird behaviour.
Homepage works fine.
Tags (taxonomy) list page, first post-cards are not displayed, but when clicked “Load more” then next posts are displayed correctly.
git clone --single-branch -b hugo-forum-topic-41917 https://github.com/jmooring/hugo-testing hugo-forum-topic-41917
cd hugo-forum-topic-41917
hugo server
Additionally, you have hardcoded the page collection in your “pagination” partial. That’s not going to work. I suggest you pass a page collection to the partial.