I'm trying to override the titles of taxonomy terms. Not the page title, the heading tag at the top of the taxonomy term page.

I found the Taxonomy Title module that created to control the title individually for every term.

This module was designed to update the heading tag at the top of the taxonomy term page. The contents of this H1 (or sometimes H2) tag are extremely important for SEO (Search Engine Optimization).

This module seems good but it doesn't give us the option to set global patterns for taxonomy terms, we can only set titles individually for each term.

There is an issue opened about global pattern but there is no solution presented.

How can I create global patterns for taxonomy terms?

Example (from the issue):

A real estate company is listing its offerings and each property is tagged with location.

Then for the location vocabulary I could set a pattern "Properties in the [term] area".

Note 1: the Page Title module doesn't give us the opportunity I wanted but we can set global patterns for page title with that module.

Note 2: It's possible to set global title pattern with the Automatic Nodetitles module for only nodes. I wonder if it is possible to use this kind of module (or piece of code) to set global pattern for taxonomy terms.

  • Have you looked at Auto Entity Label? drupal.org/project/auto_entitylabel. It handles a broader range of use cases than just node titles. It also migrates existing ANT config, bonus. Nov 28, 2014 at 17:30
  • Thanks, I installed this module but it's not possible to create global patterns for the taxonomy title with this module. I want to set global patterns for only the title (not for the page title, not for the taxonomy name itself).
    – herci
    Nov 29, 2014 at 16:05
  • So to clarify, you want the H1 heading (title) per term page to be overridden with a default output pattern set on its vocabulary? I'm assuming you don't want to do this at a theming / hook / view level, as you want to keep taxonomy data centralised and manageable via the existing taxonomy UI. I'd tend to agree. It appears that the only workaround currently involves hardcoding patterns elsewhere. Unless you feel like picking up where that feature request in Taxonomy Title left off... :( Nov 29, 2014 at 18:34
  • Actually, after reading your message, especially 'you don't want to do this at a theming / hook / view level' sentence I asked myself 'why not?' :) I did that with theming as explained here (othermachines.com/blog/…). Thanks.
    – herci
    Nov 29, 2014 at 18:57
  • I guess it depends on your use case. If you've got a large amount of vocabs which require editorial management, then creating code-level overrides isn't preferable. If it's just a few vocabs and you don't need editors poking around, you can do it fairly simply in code / views. Nov 29, 2014 at 19:05

1 Answer 1


As I said above (in the question), there isn't any module for overriding the H1 heading (title).

I could do this as explained here:

  1. I copied (and pasted) the page.tpl.php into my theme folder.
  2. I renamed it page--vocabulary--[machine name].tpl.php

    (for me it was: page--vocabulary--cities.tpl.php

  3. Opened the template.php file in the theme folder. And added this function:

(I've already had the preprocess_page function in the template.php file and I didn't add the preprocess_page function again, I added the if (arg(0) ... part. Don't forget to change the THEME to your theme name.)

function THEME_preprocess_page(&$vars) {
  if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
    $term = taxonomy_term_load(arg(2));
    $vars['theme_hook_suggestions'][] = 'page__vocabulary__' . $term->vocabulary_machine_name;

  1. Opened the page--vocabulary--cities.tpl.php file and found that line:

(Your theme's template.php file may be different but the main structure is the same.)

<?php if ($title): ?><h1 class="title" id="page-title"><?php print $title; ?> CUSTOM TEXT</h1> <?php endif; ?>

  1. Cleared all caches.

Done! It works :)

(Note: This solution is per vocabulary solution and if you've got a large amount of vocabularies this solution maybe not very for you.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.