Friday, July 1, 2011

Adding meta description & keywords to the Drupal 7 head

You can use drupal_add_html_head() for adding meta description and meta keywords in header. In your theme template.php file, you can call hook_page_alter() for embeding meta. If you want to add meta description and meta keywords in your site then go to your template.php file and paste the code (display below):

function YOURTHEMENAME_page_alter($page) {
$meta_description = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'description',
'content' => 'some description here'
)
);
$meta_keywords = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'keywords',
'content' => 'some, keywords'
)
);
drupal_add_html_head( $meta_description, 'meta_description' );
drupal_add_html_head( $meta_keywords, 'meta_keywords' );
}

11 comments:

pepper said...

that's totally useless

Anonymous said...

yes. totally stupid way.....

Anonymous said...

Your ѕtyle is very unique сomρarеd to
other fοlks Ι have read stuff from. Many thаnkѕ for ρosting whеn you've got the opportunity, Guess I will just book mark this web site.

My web page ... Boston Car Service

Anonymous said...

This is useless. It's not working. It renders my page; BLANK!!!
Best solution; use a module by name.....meta tag.

Anonymous said...

Thanks for sharing your thoughts about purchasing mattress toppers.

Regards

Feel free to visit my blog ... organic wool mattress protector

Anonymous said...

Good way of telling, and good post to obtain data regarding my presentation subject, which i am going
to convey in school.

Also visit my web-site: mold inspection brooklyn ()

Anonymous said...

Make sure to download and use our hack to get your free Gems,
Gold and Energy in Brave frontier.

My homepage ... brave frontier hack download no survey no password

Anonymous said...

smokeless cigarettes, e cigarette forum, ecig, ecigarette, e cig forum, electronic cigarette

Anonymous said...

Tv Online Live Streaming Indonesia HD

Anonymous said...

Bio Energizer Card alat kesehatan yang multi fungsi
parfum yang mengandung pheromone
pheromone murah
pheromone perfume
pheromone empowers
parfum pheromone terbaik
jual pheromone asli
fungsi pheromone

Zahra Adiba said...


This is my first time visit at here and i am in fact happy to read all at single place.
Obat Kutil Kelamin
Cara Mengobati Kutil Kelamin
Pengobatan Kutil Kelamin
Obat Menghilangkan Kutil Kelamin
Obat Kutil Kelamin Tradisional
Obat Kutil Kelamin De Nature
Obat Kutil Kelamin Herbal
Pengobatan Herbal Penyakit Kelamin
Obat Sipilis Kencing Nanah Wasir Kutil Kelamin
Ambeien Kutil Kelamin Sipilis Kencing Nanah
Sipilis Kencing Nanah Kutil Kelamin Wasir
Sipilis Apakah Menular
Apakah Sipilis Bisa Sembuh Sendiri
Apakah Sipilis Bisa Sembuh Total
Apakah Sipilis Bisa Kambuh
Sipilis Cure
Sipilis Dan Cara Penularannya
Sipilis Dan Pengobatannya
Sipilis Disebabkan Oleh Bakteri
Sipilis Dan Gonore
Sipilis Dan Hiv
Tanaman Obat Herbal
Hubungan Sipilis Dan Hiv
Obat Sipilis Herbal
Sipilis Itu Penyakit Apa Sih