Adding your META tags on to a drupal page

Tagged:  

Most blogging systems OR CMSes don't have the option to add the META KEYWORDS and META DESCRIPTION tags which are the key to search engine success to some extent.

Yes, I know you can add them in theme files... but if you change theme ? You have to re-add them. So we need a persistent solution which doesn't change while changing themes.

Below is a simple procedure where you can add your META tags to a drupal (taking 5.x here) system (without editing any of the theme files!).

Open common.inc in your favourite editor. common.inc is found in <drupal-install-path>/includes

Scroll down to Line Number 116 (or search for drupal_get_html_head).

After the first function line, you will see a line like this -

 
$output = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";

You then append these lines RIGHT AFTER the above line (else its not going to work).


$output .= '<meta name="keywords" content="keywrd1,keywrd2,..." />'."\n";

$output .= '<meta name="description" content="A small description here" />'."\n";

Save the file. Make a backup of the older file and place this new common.inc overriding the old one.

The above method has been tested and was found to work. So, if you have any problems just comment down here!

Have a nice day!

Trackback URL for this post:

http://www.itech7.com/trackback/117

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <h1><h2><h3><h4><h5><h6><b><i><u><style><div><span><li><ol><ul><img><s><em><strong><a><address><blockquote><table><td><tr><th><caption><p><br><pre><code><fn><footnotes><dl><dt><dd><font>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Use [fn]...[/fn] (or <fn>...</fn>) to insert automatically numbered footnotes.

More information about formatting options

CAPTCHA
This is to verify that you are human visitor
18 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Syndicate content
All trademarks and copyrights on this page are owned by their respective owners. Comments are owned by the Poster. Rest Copyright © iTech7.com

For License and Copyrights see http://www.itech7.com/Content-Copyrights