Pagination with Hugo

I am trying to filter the main landing page on my site to a particular content type. “posts”. Any idea what I am doing wrong here.

`{{ define "main" }}`
`<div ref="streamContainer" class="stream-container">`
`<div class="post-list-container post-list-container-no-background">`

`{{ $paginator := .Paginate (where .Site.Pages "Type" "post") }}`

`{{ range $paginator.Pages }}`


`{{ end }}`


`{{ end }}`

My understanding is that “Type” is picked up from the first directory of my content which is either “tech” or “posts”

Here Is the full code.

Although my site is originally based on a template, I have made enough changes to it that I have pulled it into my git repo.

{{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") }}

EDIT: still investigating…

OK, two issues:

  1. The content type is “posts” not “post” because you used the plural form when naming the directory.

    {{ $paginator := .Paginate (where .Site.Pages "Type" "posts") }}

  2. There’s a paginator conflict with

    If you remove {{- partial "extrabar.html" . -}} from
    themes/diary/layouts/_default/baseof.html you will get the desired result.

    Or you can move {{- partial "extrabar.html" . -}} below
    {{- block "main" . }}{{- end }}.

    Contact the theme author for further assistance:

Thanks, makes sense as it looks like extra bar is used for the page navigation. (next prev). If I understand correctly Paginator is basically a singleton and can only be defined once per page. *(Once created for page it can’t be changed)"

The .Paginator is static and cannot change once created.