# How to Exclude Pages from Paginator

**URL:** <https://discourse.gohugo.io/t/how-to-exclude-pages-from-paginator/25335>\
**Category:** Uncategorized\
**Tags:** pagination\
**Created:** [May 7, 2020, 1:07pm UTC](https://discourse.gohugo.io/t/how-to-exclude-pages-from-paginator/25335 "2020-05-07T13:07:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwhli](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bwhli/32/10354_2.png) [@bwhli](https://discourse.gohugo.io/u/bwhli)\
**Post date:** [May 7, 2020, 1:07pm UTC](https://discourse.gohugo.io/t/how-to-exclude-pages-from-paginator/25335/1 "2020-05-07T13:07:36Z")

</div>

Hello, I have my index.html [here](https://github.com/bwhli/brianli.com/blob/master/layouts/index.html).

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.

> **[Brian Li](https://brianli.com/page/12/)**
>
> Brian Li is a writer, musician, and photographer based in Tokyo, Japan.

Does anyone know what I’m doing wrong?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [May 7, 2020, 1:11pm UTC](https://discourse.gohugo.io/t/how-to-exclude-pages-from-paginator/25335/2 "2020-05-07T13:11:37Z")

</div>

> [@bwhli](#):
>
> 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:

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

---

<div class="post-metadata">

**Author:** ![bwhli](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bwhli/32/10354_2.png) [@bwhli](https://discourse.gohugo.io/u/bwhli)\
**Post date:** [May 7, 2020, 1:26pm UTC](https://discourse.gohugo.io/t/how-to-exclude-pages-from-paginator/25335/3 "2020-05-07T13:26:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bwhli](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bwhli/32/10354_2.png) [@bwhli](https://discourse.gohugo.io/u/bwhli)\
**Post date:** [May 7, 2020, 1:43pm UTC](https://discourse.gohugo.io/t/how-to-exclude-pages-from-paginator/25335/4 "2020-05-07T13:43:03Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [May 7, 2020, 2:01pm UTC](https://discourse.gohugo.io/t/how-to-exclude-pages-from-paginator/25335/5 "2020-05-07T14:01:41Z")

</div>

> [@bwhli](#):
>
> Can you let me know where you are seeing the first {{ $paginator := .Paginator }}?

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

---

<div class="post-metadata">

**Author:** ![bwhli](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bwhli/32/10354_2.png) [@bwhli](https://discourse.gohugo.io/u/bwhli)\
**Post date:** [May 7, 2020, 2:11pm UTC](https://discourse.gohugo.io/t/how-to-exclude-pages-from-paginator/25335/6 "2020-05-07T14:11:04Z")

</div>

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!
