How to add a page number to the blog post list page title in Hugo

Some search engines don't like when website has pages with the same titles...

Page content

To add the Page number to the blog post List page title in Hugo, you need to modify your list template

(usually layouts/blog/list.html or layouts/_default/list.html, sometimes even the layouts/_default/baseof.html) to detect if you are on a paginated page. Then, adjust the title dynamically by appending the page number when appropriate.

hugo-site-generator

Common description

The essential idea is to use Hugo’s built-in paginator object and conditionally render the page number if it’s greater than 1. Here’s how you can do it:

  1. Access the paginator:
    Use .Paginator on your list page to work with pagination.
  2. Check for current page:
    Use .Paginator.PageNumber to get the current page number.
  3. Conditional title logic:
    • If on page 1, show the regular title ({{ .Title }}).
    • If on page 2 or higher, append " - Page X" to your title.

Example Hugo template code (for your list.html partial, or in the `` tag of your baseof.html/layouts):


  {{ .Title }}{{ if gt .Paginator.PageNumber 1 }} - Page {{ .Paginator.PageNumber }}{{ end }}

Or, in your actual page markup:


  {{ .Title }}{{ if gt .Paginator.PageNumber 1 }} - Page {{ .Paginator.PageNumber }}{{ end }}

Notes:

  • This works on paginated list pages (section, taxonomy, etc.) since .Paginator is available.
  • .Paginator.PageNumber returns the current page number.
  • Only append “Page X” for subsequent pages, not for the first page.

References:

  • Hugo list and pagination guides show .Paginator.Project and dynamic headers are the recommended way.
  • Adjust the location based on whether you want this in the browser tab (i.e., <title>) or on-page headings.

If you want the page number to show up in the HTML <title> element for SEO, place the logic above in the proper location in your HTML head (often layouts/_default/baseof.html). For visual page headings, place it wherever you output the section title.

There is no official shortcode for this - it is a pattern set directly using Hugo templating in your layouts.

MainRoad modification

This website is currently using Mainroad theme. So to improve on-page SEO for this site I have fixed title generation in blog post index pages like this:

<title>{{ block "title" . }}{{ if .IsHome }}{{ .Site.Title }}{{ if and (eq .Kind "home") .Paginator (gt .Paginator.PageNumber 1) }} - Page {{ .Paginator.PageNumber }}{{ end }}{{ else }}{{ .Title }}{{ if and (in (slice "section" "taxonomy" "term") .Kind) .Paginator (gt .Paginator.PageNumber 1) }} - Page {{ .Paginator.PageNumber }}{{ end }} - {{ .Site.Title }}{{ end }}{{ end }}</title>