Don't paginate posts in subfolders

├── content
│   ├── _index.md
│   └── posts
│       ├── _index.md
│       ├── foo.md
│       ├── bar.md
│       ├── subfolder
│       │   ├── _index.md
│       │   ├── subfoo.md
│       │   ├── subbar.md

Is it possible to not paginate posts that are in the subfolder? I.e. I want to be able to see foo and bar, but not subfoo nor subbar nor subfolder as a post.

Here is part of my template:

{{ $pages := where site.RegularPages "Section" "posts" }}
{{ $paginator := .Paginate $pages.ByDate.Reverse }}

You want to use page.RegularPages method not the one from site. They behave different.

If you are on the posts list page just use .RegularPagesor $.RegularPages depending on your current context.

If you are somewhere else (fe homepage) use something like

{{ with site.GetPage "posts" }}
  {{ .RegularPages }}

See

1 Like

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