Hi all,

I am trying to add words for Meta Title, Meta keywords and Meta Description but I can only see fields for 'keywords' and 'Description'. Am I missing a Meta Title field?


Members fund testing for the Drupal project. Drupal Association Learn more


valthebald’s picture

Status: Active » Closed (works as designed)

Title is not a meta tag. If you want to manage it, please use http://drupal.org/project/page_title module

Juc1’s picture

OK, thank you.

skorzh’s picture

21.92 KB

As a workaround, you can add a new field (field_meta_page_title)

Meta title field

And add this code to your template.php file:

function THEME_NAME_preprocess_html(&$head_elements) {
  $elements = drupal_add_html_head();
  if (!empty($elements['metatags_quick_meta_page_title']['#attributes']['content'])) {
    $head_elements['head_title'] = $elements['metatags_quick_meta_page_title']['#attributes']['content'];
Xen’s picture

Version: 7.x-1.7 » 7.x-2.x-dev
Status: Closed (works as designed) » Active
1.97 KB

While the title isn't a meta tag, it's quite possible to create a meta title tag. There's generally much confusion of the two, som SEO people talking about 'meta title' when they in fact mean the title tag, and no-one seems to be able to prove any advantages to using meta title.

However, it can be put to good use nevertheless. Attached patch defines the title meta tag, and provides a new formatter for meta tags that sets the page title. Apart from allowing those wanting the title meta tag to use it, it can be used to make meta title act as an override for the title. This means moving in on page_title territory, but metatags_quick have the advantage of also working on non-node pages. It also makes sense as meta tags is the focus of SEO folks, and the other big SEO thing is ensuring the proper title, which isn't always best title for the node.

Also worth noting that it seems that the metatag module supports a 'meta title' element by setting the page title.

arrubiu’s picture

I've tryed instruction in #3, but I notice that the drupal_add_html_head() returns me metatags_quick values only in not-node pages.
Is it normal?

kaldimar’s picture

#3 worked fine for me on path-based pages

stella’s picture

Status: Active » Needs review
2.53 KB

The patch from comment #4 above works great, except that it also changes the h1 title printed on the page. I'm looking for a solution that allows me to have a completely different title in the <title> tag and also allows me to override the default pattern (ie. including the "| sitename" part).

The attached patch builds upon the one from comment #4. Basically when the display formatter is set to "default metatags_quick formatter" and the meta tag field is the title, it sets the "title" tag in addition to the meta tag of type "title". This allows me to have a different page title from the one in the h1 tag, and also allows me to remove the "| sitename" or change it in whatever way I wish.

valthebald’s picture

#7: thanks for a great amount of work. While the patch looks ok from the first sight, I would like to hear some responses if we need such a functionality inside metatags_quick (and not page_title, for example)

stella’s picture

@valthebald I guess one of the real benefits of this module over page_title is the ability to specify it for non-node pages, such as Views and Panels, that's why I did i this way.

valthebald’s picture

Status: Needs review » Fixed

@stella: sounds like a valid use case, I never considered that
Committed to 2.x-dev, thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

John Carbone’s picture

Status: Closed (fixed) » Needs review
677 bytes

Found an odd bug in this. The patch in #7 doesn't work unless the page_title module is present and enabled.

If I turn off the page_title module, the functionality added by #7 above stops working. I'm using the metatag module suite and had page_title enabled as well as metatags_quick. I'm completely dropping page_title from the mix as it's no longer wanted/needed.

My use case was that the metatags modules left a hole with adding tags to Views pages. My customer has no access to the Views admin area so it wasn't possible to allow them to update their own tags on Views pages using the metatag module suite. metatags_quick, along with Stella's patch above filled that gap.

Here's a patch that removes the (unexpected) page_title module dependency.

Xen’s picture

@John Carbone

Doesn't make sense, drupal_set_title() is *the* way to set the title. If drupal_set_title() doesn't work, you have something else that messes with the title.

John Carbone’s picture

Agreed, it's a head scratcher. With regard to the possibility of some other code getting in the way, I don't have any custom code running that calls drupal_set_title directly although I do have something that runs drupal_get_title (which calls drupal_set_title with no parameters to get it).

Anyway, the original patch in #7 includes code that wasn't getting run in my testing. As far as I can tell, this was a simple oversight. The code below (from #7) was never getting hit because the patch was calling drupal_set_title directly, rather than using _metatags_quick_add_head (where the code below was added in #7). _metatags_quick_add_head does some cleanup on existing tags in the head and eventually calls drupal_add_html_head by default which "Adds output to the HEAD tag of the HTML page." Since the intent here is not to change the title of the page itself but rather to change the page title in the head of the document, this all seems logical to me, but maybe I'm missing something.

+    if ($item['name'] == 'title') {
+      $element = array(
+        '#tag' => 'title',
+        '#value' => $item['content'],
+      );
+      drupal_add_html_head($element, 'metatags_quick_' . $item['name']);
+    }

I have no experience with this module's code to speak of but it all makes sense to me. Perhaps stella or valthebald can point us in the right direction. :)

[EDIT] @Xen I'd only skimmed the issue and missed that you had submitted the first patch that got this moving in the first place. I leave it up to you guys to decide if you want to use it or not.

Xen’s picture

Category: Support request » Bug report
Issue summary: View changes
Status: Needs review » Active

OK, I'll have to reopen this issue, because the committed patch is broken, it results in duplicated title elements.

stella is right in the observation that drupal_set_title() messes with both the tag and the primary
page title, due to the fact that both use drupal_get_title().

However, the patch results in 2 title tags when using the default metatag formatter on a metatag named title, which results in invalid markup (only one title element allowed).

A solution to stellas issue would be to change the set title formatter to store the title, and have a hook_preprocess_html() override the head_title and head_title_array variables for the template.

And I'm slightly piqued that the commit message credits only stella, thought most of the code is mine.

Xen’s picture

Status: Active » Needs review
4.38 KB

New patch.

This removes stellas addition and adds an option to the "Set page title" formatter to select the method used. There's the drupal_set_title method which can be used by those that prefer the meta title to override the node title on node view, and there's the preprocess_html for those that just want to set the title element in the head.

John Carbone’s picture

@Xen, love the idea of being able to pick drupal_set_title or just the head title.

BTW, after posting my previous comments I later found that the Omega theme was messing with the output I was getting. I should have been testing against a clean install. Sorry for the confusion.

Jim Kirkpatrick’s picture

Status: Needs review » Reviewed & tested by the community

Tested patch in 16 and looks good to me. Meta title tag is back, having replaced the duplicate title tag.

Jim Kirkpatrick’s picture

Jim Kirkpatrick’s picture

Priority: Normal » Major

Upgrading - this messes with SEO, and is invalid HTML on basically every page on the site using this module.

Xen’s picture

Care to elaborate on that? What invalid HTML are you seeing?

Jim Kirkpatrick’s picture

@Xen, having more than one tag is invalid HTML5 (and 4). See http://www.w3schools.com/tags/tag_title.asp:

Note: You can NOT have more than one element in an HTML document.

Your patch fixes it, so it's more the current release of the module generates invalid HTML.

Xen’s picture

Ah, I was confused as to which version we were talking about.

Yeah, current version produces invalid HTML.

loominade’s picture

Here is an hotfix for this issue:

 * Implements hook_html_head_alter().
function metatags_quick_fix_html_head_alter(&$head_elements) {
  if(isset($head_elements['metatags_quick_title'])) {

function metatags_quick_fix_process_html(&$vars) {
  $node = menu_get_object();
  if(isset($node->meta_meta_title['und'][0]['metatags_quick'])) {
    $vars['head_title'] = $node->meta_meta_title['und'][0]['metatags_quick'];

  • Xen authored f6d8702 on 7.x-2.x
    Issue #1160402 by Xen, John Carbone, stella: Meta Title field
valthebald’s picture

Status: Reviewed & tested by the community » Fixed

Fixed and pushed to 7.x-2.x http://drupalcode.org/project/metatags_quick.git/commit/f6d8702
Thanks everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

meramo’s picture

Status: Closed (fixed) » Needs work

I have to reopen the issue, as I have the latest dev build (7.2.9+1-dev) installed, and it produces exactly two tags. Can anyone please confirm that?

zniki.ru’s picture

I confirm, when I use widget "Default metatags_quick formatter".
There are 2 tags.
If I use widget "Set page title", there is only 1 , but this title generated by views.