Paginator Next/Prev always false

I may have misunderstood the difference between .Paginate and .Paginator but I’m trying to create pagination by weight with a length of 2:

{{ $paginator := .Paginate (first 2 .Pages.ByWeight) }}
{{ range $paginator.Pages }}
	<h2>{{ .Title }}</h2>
{{ end }}
<h2>{{ $paginator.HasNext }}</h2>
<h2>{{ $paginator.HasPrev }}</h2>

The title gets displayed (2 items) but the HasNext and HasPrev function always returns false. When using {{ .Paginator 5 }} it works fine, but I don’t know how to order by weight/date etc.

Many thanks in advance.

If you have 100 pages, does this mean you want 50 pagers, with 2 pages per pager?

Yep, 100 posts, 50 pages. Can’t figure it out.

If you want two pages per pager, either:

  1. Set paginate in your site configuraiton to 2
  2. Provide a second argument to the .Paginate method

Like this?

{{ $paginator := .Paginate (first 2 .Pages.ByWeight) 2 }}

Not sure why the docs would be indicating otherwise.
Still can’t get next/prev working

Thanks in advance

You are getting the first two pages, then paginating with 2 pages per pager, resulting in 1 pager, so there isn’t a previous or next.

Get rid of the first 2 part.

Thank you @jmooring !

Do you think it’s worth me making a PR to adjust the docs, It don’t think it says that .Paginate takes two args?

Well, we already have this, so…