Change page title during pagination

Hello,

How can I change the title of the page with pagination, at the moment all my page title are the same for the pagination.

This is what I have

`{{ partial “head” . }}
{{ range (where .Site.Pages “Type” “article”).GroupByDate “2006” }}

{{ .Key }}

    {{ range where .Pages "Type" "article" }} {{ .Render "archive-item"}} {{ end }}
{{ end }} {{ partial "modules/disqus-article-count" . }} {{ partial "foot" . }} `

How can I change the title in this case, where the title is in the partial head.

This is partial head.
`
<!DOCTYPE html>
{{ "<!–[if lt IE 7]>" | safeHTML }} <html class="no-js lt-ie9 lt-ie8 lt-ie7"> {{ "<![endif]–>" | safeHTML }}
{{ "<!–[if IE 7]>" | safeHTML }} <html class="no-js lt-ie9 lt-ie8"> {{ "<![endif]–>" | safeHTML }}
{{ "<!–[if IE 8]>" | safeHTML }} <html class="no-js lt-ie9"> {{ "<![endif]–>" | safeHTML }}
{{ "<!–[if gt IE 8]><!–>" | safeHTML }} <html class="no-js"> {{ "<!–<![endif]–>" | safeHTML }}
<html lang="en">
<head>
<link href="http://gmpg.org/xfn/11" rel="profile">

{{ partial "base/head/metas" . }}
{{ partial "base/head/styles" . }}
{{ partial "base/head/scripts" . }}

{{ if .IsHome }}
<title>{{ .Site.Params.description }} · {{ .Site.Title }}</title>
{{ else }}
<title>{{ .Title }} · {{ .Site.Title }}</title>
{{ end }}

</head>
<body>
<div id="layout" class="pure-g">
{{ partial "sidebar" . }}
<div class="content pure-u-1 pure-u-md-3-4">
`

Ilija

If you use the “standard paginator”, you can just add something like:

{{ if .IsNode }}{{ .Paginator.PageNumber }}{{ end }}

Next to the title.

See bottom here for more attributes:

For more complex paginators (with where etc.) it must be defined before the head partial include, I guess.

I will have to check up on how this will work with the new block keyword in Go 1.6.

how to skip the first page from showing Page 1 and only display this on Page 2 and so on?

1 Like

I need this too.

Something like this:

{{ if .IsNode }}
{{ if gt .Paginator.PageNumber 1 }}
{{ .Paginator.PageNumber }}
{{ end }}
{{ end }}