Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I would like to know how to set description and meta keywords for the front page. I use the Meta tags module for articles, but it is not working for the front page.

I use Panel as my front page.

My website is http://www.techiestuffs.com, and runs on Drupal 7.

if you see the HTML source of the front page, it only contains the following HTML:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="shortcut icon" href="http://www.techiestuffs.com/sites/default/files/favicon.png" type="image/png"/>
<meta name="Generator" content="Drupal 7 (http://drupal.org)"/>
<title>TechieStuffs | Stuffs for Geeks</title>

I had tried adding these functions in template.php:

function yourtheme_page_alter($page) {
  $meta_description = array(
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#attributes' => array(
    'name' => 'description',
    'content' =>  'Description about the site'
  ));

  $meta_keywords = array(
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#attributes' => array(
    'name' => 'keywords',
    'content' =>  'Some Keywords about the site'
  ));

  drupal_add_html_head($meta_description, 'meta_description');
  drupal_add_html_head($meta_keywords, 'meta_keywords');
}

But this function does not seems to work as you can see in my websites source code.

Does anyone know how to work out this?

share|improve this question
1  
I checked meta tag module, you can set default for front page... –  Mohammad Ali Akbari Apr 28 '12 at 6:32
1  
Welcome to Drupal Answer, if the answer is helpful for you consider selecting it as the correct answer. There is a checkmark below the answer ratings. ▲ ▼ √ –  Nikhil M May 6 '13 at 4:45
    
If you are using Panels for your home page and the MetaTag module drupal.org/project/metatag you need to make sure that in addition to enabling the basic MetaTag module, you also enable MetaTag: Panel submodule. This will allow you to set metadata for panel pages. –  kbrinner Mar 13 at 21:38
add comment

5 Answers 5

Add them in your theme file; whichever theme you're using, it should have an HTML skeleton that you can change.

share|improve this answer
    
I used this code in template.php –  vividvilla Dec 24 '11 at 9:36
    
drupal_add_html_head( $meta_description, 'meta_description' ); drupal_add_html_head( $meta_keywords, 'meta_keywords' ); –  vividvilla Dec 24 '11 at 9:37
    
but still meta not showing up –  vividvilla Dec 24 '11 at 9:37
    
add it statically in .tpl file of theme where you have head tag. check you theme folder and front.tpl file. –  Code Lღver Dec 24 '11 at 9:39
    
is your meta description is dynamic ? –  Code Lღver Dec 24 '11 at 9:40
show 4 more comments

In drupal 6 I used Nodewords which allowed you to set meta tags on the front page as a configuration. In D7 this has been replaced by Meta Tags which may do the same thing or you.

share|improve this answer
    
But My front page is a panel so the front page ovberride doesn't work and i also tried to assign meta tags for panels but it is also not showing up. –  vividvilla Dec 26 '11 at 8:45
    
Does it work for a simple front page? It being a panel shouldn't matter I would have thought. –  Malks Dec 29 '11 at 2:21
add comment

Unfortunately, Views or Panels do not have meta tags by default. If you use either one for your frontpage, you can use the Meta Tags Quick Module, which allows the addition of the main meta tags for any path that is generated by Drupal.

share|improve this answer
add comment

I'm using Path-Based Metatags option in Meta tags quick module, enable module and go to front page, you will see Path-Based Metatags option...when you click on the option, you can fill in the fields that you want, you can also set the fields that you want to display (admin/config/search/metatags_quick)...

share|improve this answer
add comment

I see this is an old thread, but in case people find and still looking for an easy solution. I didn't like the Drupal way or Meta Quick. Found this super easy module, Simple Meta, adds a tab at left side directly on every page. I edit only description and meta tag instantly appeared. https://drupal.org/project/simplemeta.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.