# Move blog posts outside index page

**URL:** <https://discourse.gohugo.io/t/move-blog-posts-outside-index-page/39455>\
**Category:** support\
**Created:** [July 11, 2022, 9:59pm UTC](https://discourse.gohugo.io/t/move-blog-posts-outside-index-page/39455 "2022-07-11T21:59:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tut](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tut](https://discourse.gohugo.io/u/tut)\
**Post date:** [July 11, 2022, 9:59pm UTC](https://discourse.gohugo.io/t/move-blog-posts-outside-index-page/39455/1 "2022-07-11T21:59:42Z")

</div>

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

```auto
{{- $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 -}}

```

---

<div class="post-metadata">

**Author:** ![willduncanphoto](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/willduncanphoto/32/11840_2.png) [@willduncanphoto](https://discourse.gohugo.io/u/willduncanphoto)\
**Post date:** [July 11, 2022, 10:08pm UTC](https://discourse.gohugo.io/t/move-blog-posts-outside-index-page/39455/2 "2022-07-11T22:08:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tut](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tut](https://discourse.gohugo.io/u/tut)\
**Post date:** [July 11, 2022, 10:32pm UTC](https://discourse.gohugo.io/t/move-blog-posts-outside-index-page/39455/3 "2022-07-11T22:32:38Z")

</div>

~~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.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [July 13, 2022, 10:32pm UTC](https://discourse.gohugo.io/t/move-blog-posts-outside-index-page/39455/4 "2022-07-13T22:32:53Z")

</div>

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