This topic is not new, but unfortunately I only knew all tricks about it recently when I have a request from my customer: "How to make page titles different from node titles, with and without patterns?"


1. Why to have 2 types of titles?

The reason is, node title is for readers, page title is for SEO. A page title of a web page is displayed on top of your browser window and the current tab.

Drupal page title vs node title

It is also selected by Google as the title of a result on the search list. Below is the page title of the article "[Drupal 7 free theme] - ST Flabiol is available for free download" when you search for the keyword "Drupal 7 free theme", 

Drupal page title in Google search

To show why you need two different tiles, let's see an example. You create a rating website, similar to ST Chapi, to review restaurants in Ohio. You create a directory of restaurant nodes on your website. When local people search a keyword about restaurants, you probably want your content nodes appear on the search results as "Lobster Restaurant in Ohio", "Finest Kitchen in Ohio" and etc ... That's targeted, catching and relevant.

However, when users view these restaurant nodes on your website, you may not want to add the postfix "in Ohio" for all nodes: Maid Cafe in Ohio, Lobster Restaurant in Ohio, Finest Kitchen in Ohio and so on .. It looks boring to readers. And you may forget to type in everytime. 

2. Set the page title with pattern

In the situation above, you can append automatically the postfix "in Ohio" to the page titles of every restaurant nodes while keeping their node titles short. With the help of the page_title module, it is easy to implement this scheme:

Step 1: Install page_title module

Step 2: Go to Admin > Configuration > Page title, and set patterns.

Set pattern for Drupal page title

You just need to add "in Ohio" after the token [node-title]. It is quite easy. You may also set patterns for other content types to suit your SEO strategy.

Note: you can also use the metatag module, it is even more powerful than page_title. It allows you to configure meta titles, descriptions and keywords at the same time, although it requires more steps. Thanks Damien for recommend this metatag module.

3. Set custom page title for individual nodes

What if your desired page titles do not follow any pattern at all? For example, you want:

  • Node "Restaurant A" page title to be "Restaurant A - Best seafood restaurant in Ohio". 
  • Node "Restaurant B" page title to be "Restaurant B - Great view and service".

In this case, you properly want to set custome page title for each nodes, regardless of the default pattern. Just go to Admin - Structure - Content types, and edit the corresponding content type.

On the Page title section, please select "Show field".

Configure Drupal page title to show editing field

Now you have two title fields, node title and page title. When editing a node, you can set node title as usual and enter a different page title on the "Page title" section at the bottom of the edit form.

Set page title for nodes in Drupal

4. Some tips to set page titles

  • Keep your page title less than 70 characters: it is better for human reading. 
  • Put your top keyword closed to the begining: and then the second top keywords, and etc ...
  • Get rid of stop words (words that carry no keyword value): such as a, an, the, but, then, if, or, what, we, he, she ....
  • Leave your company name at the end: we know you value your company brand, but put what users concern first.
  • Keep different pages different titles: do not use same page titles for multiple pages.

5. Page title for views

Please see my other post for custom page title for views in Drupal


Subscribe to our mailing list

* indicates required