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?

Thanks

Files: 

Comments

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

OK, thank you.

StatusFileSize
new21.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:

<?php
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'];
  }
}
?>

Version:7.x-1.7» 7.x-2.x-dev
Status:Closed (works as designed)» Active
StatusFileSize
new1.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.

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?

#3 worked fine for me on path-based pages

Status:Active» Needs review
StatusFileSize
new2.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.

#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)

@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.

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.

Status:Closed (fixed)» Needs review
StatusFileSize
new677 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.

@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.

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.