How to enable meta Description tag in Drupal 6

One of the nice things about Drupal is that it doesn't have those unecessary keyword and description meta tags bloating up the database and user interface. I installed an early version of MODx and found that each content item has a form field for both meta description and meta keywords. This means I have to explain to my clients why they don't need to fill those in. Don't they know that Meta tags are dead?

Anyway, you might like to use the description meta tag at least which still has support.

Drupal 6 has a string overrides function that you can adapt for this which you can find in the settings.php file:

"String overrides:
To override specific strings on your site with or without enabling locale module, add an entry to this list. This functionality allows you to change a small number of your site's default English language interface strings."

Now all you need to do is utilise one of the variables that you may not be using in the themes. I have used the "Mission statement" which I altered to "Meta Description" like this:


$conf['locale_custom_strings_en'] = array(
'Mission statement' => 'Meta Description',
'Mission' => 'Meta Description',
);

In your theme settings make sure you have the Meta Description (formerly mission statement) checkbox enabled. See admin > build > themes > settings > garland.

In your page.tpl.php file add this line in the head of the html page:

<meta name="description" content="<?php print $mission ?>" />

In Site Information fill out the Meta Description box. See: admin > settings > site-information.

And then you're done!


Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options