Dear all,
In order to gain higher search engine position, meta tag is essential. Is there any one out there who know how to add meta tag to drupal pages?


matteo’s picture

Nodewords.module is what you need.
It works on Drupal 4.4, but you can try to see if it works on 4.5 also...


andrew-leung’s picture

Hi Matteo,
What is Hx HTML header? Can you tell me how to insert the code to the theme? I am using non-php theme. Shall I need to change to use php theme in order to get the meta tag works?

chrisada’s picture

Add them in your theme file. Whichever theme you're using should have html skeleton which you can change.

Steven’s picture

Today, most search engines ignore meta tags or even use them to lower your ranking if it looks like you're abusing them.

You're much better off using clean URLs and path.module to create readable URLs, as experience has shown this to significantly improve your site's ranking.

andrew-leung’s picture

Hi steven,
Thank you for your advice. I agree with you that meta tags should not be used in an abused way. However, it is still essential. Do you know what does it mean by Hx HTML header (mentioned in earlier post by another guy)?

matteo’s picture

I've never used nodewords module, but since I already put hand on themes, I would do this (this depends on the them you will use):
Suppose you use a phptemplate engine theme:

In phptemplate.engine file I would add a call to nodewords, as suggested in the manual $nodewords = module_invoke("nodewords", "get", $node->nid);
This call should be added in function xtemplate_node(), where you'll find the declaration of alla variable substituted to the template, assigning the xtemplate nodewords variable to the template

In the template (xtemplate.xtmpl), I would add a <meta>{nodewords}<meta> tag.

This is a very rough explanation, and should be checked carefully, but hope it can help you...

Eventually, I would suggest to contact the module maintainer..


agaffin’s picture

Open xtemplate.engine in /themes/engines/xtemplate

Around line 53, where variables are assigned to the template, you'll have a line that starts with

"content" =>

Just above that line, add:

"nodewords" => (module_invoke("nodewords", "get", $node->nid)),

Next, open up xtemplate.xtmpl and add a standard meta keywords tag to the head area, with {nodeword} where the keywords would normally go.

dima’s picture

I would not add any meta tags in the xtemplate.xtmpl itself as it would really be an abuse and search engines will reduce your site's ranking. In Drupal 4.5.x xtemplate.engine sorts everything out for you and adds all meta tags "on the fly" into your page if you follow the instructions above.

PhilMW’s picture

Hi there, I've been looking in to the whole meta tags issue and have come across this thread. Please can you explain why adding them in to xtemplate.xtmpl would be an abuse that the search engines won't like. Thanks.

boy’s picture

Above? Which one?

cableray’s picture

Search engines might not rank based on meta tags, but social bookmarking site like digg and use them for proper descriptions and content. Facebook share uses them as well.

conann’s picture

Nodewords is really good in 4.5 but I am not crazy about the way it works in 4.6. Google pretty much ignores meta tags as does the new msn h1 and title are the way to go for getting search results.

gollyg’s picture

The description meta tag is still useful in search engines to create meaningful descriptions in the results page - allows you to summarise the page and add value for the user. Meta tags are not just about improving your rankings - they are about adding meaningul information about the page content. I feel that page nodes should support a description field as a core feature, but I will have a look at the nodewords module.

Ali.T’s picture

Have you figured out how to add custom description meta tag to particular pages? This is what I need also.

gollyg’s picture

I actually modified the nodewords module so that it was used for the description rather than keywords. I don't use keywords in my site. The mod is very simple, just open up the module and find any reference to 'keywords' and change to 'description'. From memory you also need to comment out the line that builds the meta description data from page contents.
Let me know if you need any help - i could email the modified module if necessary.

Ali.T’s picture

yes, if you could send me the module it would be great. I need both keywords and description fields. Could I just add another field by just duplicating the code for the existing field?

Ali.T’s picture

Works great. Found out here:

keto’s picture

I am interested in adding (meta name = blah blah ) between the (head) and /(head) tags on the main page. Is this possible without adding it to every other page on the site?

I have tried adding it to the chameleon.theme (the theme I use) however no luck. Either I am using bad syntax or that is not where I should be adding this code.

Any help would be appreciated.

- keto

Ali.T’s picture

I just write out the meta tag in php template and it works fine for me. I don't use any php code. Just put it in as if it is in html page.

   <me ta   name="robots" content="index, follow"> 
pendelton’s picture

Use drupal_set_html_head() for example:

drupal_set_html_head('<meta http-equiv="refresh" content="2;url=/">');

A good place to put this is in your templates' preprocess function if you have one (and you are using D6+).

magnoman’s picture

How can I set this function to interact with Nodewords?

In template.php of "pixture_reloaded" theme, for example:

function pixture_reloaded_preprocess_page(&$vars, $hook) {
drupal_set_html_head('<meta http-equiv="description" content=[metatags-description] '); // I invented this line

Could anybody help?

magnoman’s picture

I am using "pixture_reloaded" theme and after reading this topic I suppose this theme is not ready for nodewords... I simply doesn´t work.
I don´t have enough know-how to fix it.
Please, search google: and you´ll see the same description on each page that appears! I am mad at it!
Can somebody help me?

dhaneshmane’s picture

I am not able to set meta title through nodeword module. Meta keyword and description is working but not able to find the meta title setting.

arboldeolivo’s picture