Move blog posts outside index page

I have a section blog (/blog/nested-section/posts.md). If the nested section has an _index.html file, the blog section shows the nested-sections instead of the regular pages, even with a custom layout file. How do I make the blog show regular pages instead? My code below for the section

{{- $p1 := where (where .Site.RegularPages "Type" "post") "Params.page_number" nil }}
{{- $p2 := where (where .Site.Pages "Type" "post") "Layout" "multipage" }}
{{- $p3 := union $p1 $p2 -}}
{{- $page := slice site.Home | append $p3 -}}
{{- $paginator := .Paginate ($page.ByDate.Reverse) -}}
{{- $firstPage := true -}}
{{- range $paginator.Pages -}}
{{- if not .IsHome -}}
{{- $class := "" -}}
{{ if and (eq $paginator.PageNumber 1) $firstPage }}
{{- $class = "sticky-post" -}}
{{ end }}
<article {{ with $class }} class="{{ . }}"{{ end }}>
<h2 class="entry-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
</article>
{{- $firstPage = false -}}
{{- end -}}
{{- end -}}

Do you have a link to a repo? It could be a few things, but I am not 100% sure what you are asking so I don’t want to open my mouth without seeing the code.

~~I have re-edited the question after some debugging.

I noticed the problem might be the .Pages in $paginator. So, any further help is welcome.~~
A cached .Paginator was the culprit.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.