HUGO

Iterating over posts not in page bundle doesn't work

I’m trying to iterate over posts organized like this (czech is a language-based content directory):

hugo_content_czech

in my layouts/index.html theme template. However, code like this:

{{ $posts := where .Site.RegularPages "Type" "posts" }}
{{ printf "%#v" $posts }}

returns only:

page.Pages{}

It works just fine, if I use structure like content/czech/posts/priklad-clanku/index.md. How can I fix this? I don’t want to use page bundles because I’m using Forestry as a CMS. I also notice it works when using https://github.com/forestryio/hugo-theme-novela, but I wasn’t able to discover the catch. What should I try to fix this?

EDIT: I need to be able to paginate these posts, otherwise I could work with those posts as page resources.

Hi … have you tried .mainsections it should be what you need

Thanks, but I don’t think it’s needed, because Novela theme doesn’t use this method.

I made a stupid mistake with expirydate in the front matter. Sorry, it’s solved.

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