Showing posts with label Drupal. Show all posts
Showing posts with label Drupal. Show all posts

Sunday, April 01, 2012

Adding meta description and meta keywords in Drupal 7 is different compared with Drupal 6. I used drupal_add_html_head() for
adding meta description and meta keywords in header. In my theme (template.php file), I call hook_page_alter() for embeding meta. If you want to add meta description and meta keywords in your site then go to your site default theme folder’s template.php file and paste the code (display below) :

function yourtheme_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' );
}
Or you can use module Meta Tags Quick
http://drupal.org/project/metatags_quick

Tuesday, February 14, 2012

Create your first Drupal 7 module with the following steps.
  1. Create a folder called helloworld in sites/all/modules/custom
  2. Create a helloworld.info file
  3. Create a template file page-helloworld.tpl.php in your theme directory
  4. Enable your module at http://domain.com/admin/build/modules
  5. Visit http://domain.com/helloworld