Adding your META tags on to a drupal page
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:
- Nilesh's blog
- 262 reads












Comments
Post new comment