Unique titles for paginated content in Drupal 8

Post by Mike C Picture of Mike C
Reading time 1 mins clock

Analysing the Ixis website for page structure improvements using the SEM Rush tool highlighted a number of issues to address - some of which were based on the blog contents page.

Drupal index pages generated using Views are paginated based on the number of items per page. By default every paginated version of the View page inherits the same View page title - resulting in tools like SEMRush reporting duplicate meta data for many pages.

SEMRush errors

There's many posts 1 2, half baked custom theme code solutions and un-finished modules are knocking around the Internet - but nothing seemed to be documented on for making each page of the View unique by inserting the pagination number in to the title in a clean and simple manner.

Unique Titles for Views

Enable the "Metatag: Views" module (This module is part of the metatag module suite).

Metatag module in Views

Setting the Meta tags configuration for the View specific Page display mode shows a modal dialog to add a custom page title for the meta tags. This controls the title displayed in the browser titlebar, tab and search engine results pages.

Views meta tag page title setting

The dynamic title is generated using available tokens contained in square brackets. In our blog index page example we use "Blog page [current-page:page-number]".

Re-running the SEMRush campaign audit should hopefully improve the campaign score by removing the flagged duplicate content errors. Success!

Mike

Mike C

Managing Director

12 years of Drupal development wrangling and a background in digital project architecture.

Comments

How do you avoid the page number to show up on page one?

Benedikt

Add new comment

Share this article

Sign up to our newsletter!

Our thoughts

Let's work together

Get in touch and find out how we can empower your organisation.
Back to top