How to Exclude Pages from Paginator

Hello, I have my index.html here.

I would like to have the pagination exclude pages. I thought the code below would allow me to do this, but it is still including the pages.

{{ $paginator := .Paginate (where .Data.Pages “Type” “not in” (slice “page”)) }}

{{ range $paginator.Pages }}

If you go to this page in my pagination index, you can see that there are pages being included.

Does anyone know what I’m doing wrong?

I remember vaguely that we at some point removed the ERROR message when you create several paginators on the same page, but with different arguments.

The thing is, if you do:

{{ $paginator := .Paginator }}
{{ $paginator := .Paginate (where .Data.Pages “Type” “not in” (slice “page”)) }}
{{ range $paginator.Pages }}

You will get the unfiltered result fuirom the first invocation. The above can be a little hard to debug.

Thanks for the quick reply @bep! Can you let me know where you are seeing the first {{ $paginator := .Paginator }}?

Ah, looks like this in baseof.html might be causing issues.

{{- if eq .RelPermalink “/” -}}
{{- if ne .Paginator.PageNumber 1 -}}

{{- end -}}
{{- end -}}

I only see what you have posted, which I suspect isn’t everything – hence I’m guessing a little.

Sorry, I linked the repo in the post as well. Anyway, your comment reminded me of another .Paginator in another file that was causing the issue. Thank you!