Pagination Pages

How can I check if the page is pagination pages? but only greater than /page/1, so the homepage will be exclude.

In this case i need to add some meta tags in pagination pages

There is likely a hint for you here: https://github.com/gohugoio/hugo/blob/0859d9dfe647db3b8a192da38ad7efb5480a29a1/tpl/tplimpl/template_embedded.go#L125

Hi @budparr

I try

{{ $baseurl := .Site.BaseURL }}
{{ $pag := .Paginator }}
      {{ if .Paginator.HasPrev }}
             <meta name="robots" content="nofollow, noindex"> 
      {{ end }}
{{ end }}

it still give me an error

ERROR 2017/10/14 22:01:04 Error while rendering “home”: template: theme/index.html:10:19: executing “theme/index.html” at <partial "masonry.htm…>: error calling partial: template: theme/partials/masonry.html:2:21: executing “theme/partials/masonry.html” at <.Paginate>: error calling Paginate: a Paginator was previously built for this Node without filters; look for earlier .Paginator usage

Set the variable to .Paginate (not .Paginator) and then use it (example corrected):

{{ $pag := .Paginate .Data.Pages }}
{{ if $pag.HasPrev }}
  <meta name="robots" content="nofollow, noindex">
{{end}}
1 Like

another error
error calling partial: template: theme/partials/meta.html:3:11: executing “theme/partials/meta.html” at <.Paginate>: wrong number of args for Paginate: want at least 1 got 0

Sorry, I left out the argument when I cut-and-pasted from your example. The canonical way to create a paginator for the current list page is:

{{ $pag := .Paginate .Data.Pages }}