Unwanted "pages" show up in my list view

Hi,
a few weeks ago I decided to build my new blog with Hugo. I’ve read through the docs, experimented and learned a lot and then decided to build a theme from scratch so I can learn best about how things are put together.

I’m almost done except for one problem: In my content folder I have one single file ‘impressum.md’ and one directory ‘post’ that contains all of my blog posts which I cateorize using tags. I want my homepage to list all of my post type files but not my impressum page. But my (pagination enabled) homepage view also lists my ‘impressum’.

I only use _default/list.html for my tags lists and I grab them with {{ .Paginator.Pages }} which I use for the homepage template as well. In my impressum.md front matter, I define the type as ‘page’. My blogposts have no defined type so I assume them to be of type ‘post’. What is this Pages variable doing and how does it relate to listing "pages’ of certain sections.

I think I’ve read all the relevant docs but tags, categories, taxonomies, sections, types, page, pages, Pages!.. there seem to be a few too many abstract but very much related terms for my poor brain to handle.

Can someone please tell me what I’m doing wrong?

Personally I use a frontmatter parameter to hide pages from sections of my site.

hidden = "true"

And then

{{ range where .Paginator.Pages "Params.hidden" "ne" "true" }}

But there are several ways of doing this.

@alexandros: this is a nice idea, thanks (I have the same problem as the OP). Is it extendable to .Next and .Prev?
In other words, is there a construction which states {{ .Next if ."Next.Params.hidden" "ne" "true" }} (sorry, I do not know Go (yet))

Thanks a lot, @alexandros, for pointing me in the right direction. I found a snippet in the template function docs that make it even easier in my case:

{{ ranger where .Paginator.Pages "Section" "post" }}

This way, only my blog posts appear on my homepage.

1 Like

Um… who said that I know Go? LOL!

No. I understand just enough to get the job done in Hugo. And that is through trial and error, searching this forum, reading parts of the docs, browsing themes and other people’s projects and of course the kindness of posters in this forum. But I don’t really know it. :eyeglasses:

Now regarding pagination. I haven’t tested this since I don’t use next/prev pagination, but I think it should work.

{{ range where .Paginator.Pages “Params.hidden” “ne” “true” }}
{{with .PrevInSection }}

{{ end }}
{{ with .NextInSection }}

{{ end }}
{{ end }}