# Add .Paginator.RegularPages

**URL:** <https://discourse.gohugo.io/t/add-paginator-regularpages/5391>\
**Category:** support\
**Tags:** pagination\
**Created:** [February 8, 2017, 4:12pm UTC](https://discourse.gohugo.io/t/add-paginator-regularpages/5391 "2017-02-08T16:12:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tjallingt](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@tjallingt](https://discourse.gohugo.io/u/tjallingt)\
**Post date:** [February 8, 2017, 4:12pm UTC](https://discourse.gohugo.io/t/add-paginator-regularpages/5391/1 "2017-02-08T16:12:39Z")

</div>

Apparently this is not an “enhancement” but a “discussion topic” so I’m re-posting it here:

In the 0.18.0 update `.Site.Pages` was changed to also include other types of pages (sections, taxonomies etc).  
Then `.Site.RegularPages` was added in order to support the old behaviour which now requires a `where .Site.Pages "Kind" "page"`.

Now this change affected `.Paginator` in the same way, if you have a site that uses the paginator to split a section in multiple pages now you will also see other “kinds” of nodes instead of what happened previously. So if you want to restore the old behaviour you will have to do:

```auto
{{ $paginator := .Paginate (where .Data.Pages "Kind" "page") }}
{{ template "_internal/pagination.html" . }}
{{ range $paginator.Pages }}
   {{ .Title }}
{{ end }}

```

`.Paginator` should also have a `.RegularPages` like `.Site` in order to easily paginate **just** the pages of your site.

---

<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:** [February 8, 2017, 4:26pm UTC](https://discourse.gohugo.io/t/add-paginator-regularpages/5391/2 "2017-02-08T16:26:14Z")

</div>

> [@tjallingt](#):
>
> {{ $paginator := .Paginate (where .Data.Pages “Kind” “page”) }}

What about

```auto
{{ $paginator := .Paginate .RegularPages}}

```

Pretty clean to me, and obviously a “discussion topic”.

---

<div class="post-metadata">

**Author:** ![tjallingt](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@tjallingt](https://discourse.gohugo.io/u/tjallingt)\
**Post date:** [February 8, 2017, 5:19pm UTC](https://discourse.gohugo.io/t/add-paginator-regularpages/5391/3 "2017-02-08T17:19:27Z")

</div>

Hey,

Now i reread that i might have come across as a little bit more blunt than i intended apologies for that.  
Secondly your solution is admittedly a lot cleaner than mine but you still have to create that global $paginator variable so a solution where that would be implicit would be even cleaner 🕶.  
Lastly I don’t see why .Site can have it but .Paginate cannot (especially when the .Paginate.Pages shorthand does exist).

Now that i think about it, your solution does something different right?  
`{{ $paginator := .Paginate .RegularPages}}` will contain all pages on the site whereas `{{ $paginator := .Paginate (where .Data.Pages "Kind" "page") }}` will only contain the pages relevant to the current page (current Taxonomy). Although admittedly I don’t fully understand all of the recent changes so i might be wrong here.

---

<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:** [February 9, 2017, 8:31am UTC](https://discourse.gohugo.io/t/add-paginator-regularpages/5391/4 "2017-02-09T08:31:36Z")

</div>

Your solution does not work. The paginator is static, i.e. only one.

---

<div class="post-metadata">

**Author:** ![tjallingt](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@tjallingt](https://discourse.gohugo.io/u/tjallingt)\
**Post date:** [February 9, 2017, 10:36am UTC](https://discourse.gohugo.io/t/add-paginator-regularpages/5391/5 "2017-02-09T10:36:13Z")

</div>

I don’t understand at all, if I test any of this locally it seems to work but some of the behaviour does not match what it used to do in Hugo 0.17.0.

if any of my sections contain an [index.md](http://index.md) the paginator displays this but the url for the index page is the same as the url for the list. My initial expectation was that the [index.md](http://index.md) of a section was of the newly created “section” kind. However i just tested this with:

```auto
{{ range .Data.Pages }}
   {{ .Kind }}
{{ end }}

```

And it only showed “page” for every md file in the section.

The reason I have this strange structure happened is because i have an about page structured like this: `content/about/index.md`. In Hugo 0.17.0 visiting `/about/` would just shows `single.html` in Hugo 0.18.0 it shows `list.html` with one item that has the same url (`/about/`) and therefore cannot be opened.

I guess I’ll stick to Hugo 0.17.0 for now because i don’t even understand how the new “home” and “section” kinds work and my pagination contains these broken pages that i have no idea how to filter out.

---

<div class="post-metadata">

**Author:** ![digitalcraftsman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/digitalcraftsman/32/4142_2.png) [@digitalcraftsman](https://discourse.gohugo.io/u/digitalcraftsman)\
**Post date:** [February 9, 2017, 2:29pm UTC](https://discourse.gohugo.io/t/add-paginator-regularpages/5391/6 "2017-02-09T14:29:14Z")

</div>

> [@tjallingt](#):
>
> I guess I’ll stick to Hugo 0.17.0 for now because i don’t even understand how the new “home” and “section” kinds work and my pagination contains these broken pages that i have no idea how to filter out.

In Hugo 0.18 everything became a page, even nodes. To make them distinguishable, each page is of a certain kind, i.e. a page is of kind section (which was formerly be a node).

You could filter them out by checking the `.Kind` attribute and use only those kind of pages you really want to use. But as @bep suggested, use `.RegularPages` because this list only contains “real” pages, i.e. those page you know as pages from previous Hugo versions.

---

<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:** [February 9, 2017, 3:49pm UTC](https://discourse.gohugo.io/t/add-paginator-regularpages/5391/7 "2017-02-09T15:49:53Z")

</div>

An added note to that:

`.Data.Pages` and its alias `.Pages` contains the _contextual_ pages that belong to a given list page. For the _home page_, that list will contain every page except itself (including regular pages, taxonomy lists etc.). The same list on a _section page_ will only contain regular pages that belongs in that section.

The `.Pages` collection on the paginator object is, by default, based on the above. You can change that by passing a custom collection to it (`.RegularPages` or one created with `where`). It doesn’t make sense, nor is is it possible, to add a `paginator.RegularPages`, as it will only be one for a given page: `.Pages` holds the pages (default 10) for the current pager, and the pages can be regular or whatever, but it can only be one collection.

---

<div class="post-metadata">

**Author:** ![tjallingt](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@tjallingt](https://discourse.gohugo.io/u/tjallingt)\
**Post date:** [February 9, 2017, 4:49pm UTC](https://discourse.gohugo.io/t/add-paginator-regularpages/5391/8 "2017-02-09T16:49:58Z")

</div>

> [@digitalcraftsman](#):
>
> In Hugo 0.18 everything became a page, even nodes. To make them distinguishable, each page is of a certain kind, i.e. a page is of kind section (which was formerly be a node).

I understand this but expected the other kinds of pages to also receive data from markdown files in the content folder which is not the case, only pages of type “page” seem to have a markdown data associated with them.

Reading issue 2240, 720 and 330 (cant link directly) gave me the idea that `content/index.md` would be of kind “home” and provide `layouts/index.html` with its data. I also assumed that these pages should now be filtered out of the paginator which doesn’t seem to be the case. I still do not understand how the changes made in Hugo 0.18.0 allow us to designate a page as “section” or “home” or how to use/access these kinds of pages from a layout.  
Say I want an “about me” section on my homepage that is authored in markdown how would i create the markdown file containing this information and how should `layouts/index.html` access this? I assume it involves `.Site.GetPage` but can’t find a clear explanation.

Additionally Hugo seems to have trouble figuring out how to display a `index.md` file inside a section. For sections that did not contain any other markdown files Hugo used to just render `single.html` for that section however now it appears to render `list.html` with one item who’s `.Permalink` is the same as the list page. This confused me further as i assumed this might be an example of a page of kind section but I was wrong.
