We have a drupal site up and running which an old colleauge made and I am currently updating the site and enhancing search engine optimisation but im new to using Drupal. Can I add a description meta tag to the pages on my site and if so how?
please explain to a complete newbie. thanks

Comments

nevets’s picture

I would suggest looking at the MetaTags module.

estnyboer’s picture

Head tag information is loaded via html.tpl.php

You should find this file in theme/THEMENAME/templates

Open it and you will see familiar info. You can edit it to include meta tags.

If your theme doesn't have this file (the Skeleton theme, for example, does not), you can find it at modules/system/html.tpl.php. Copy this file to your theme/THEMENAME/templates directory and edit as desired; it will override the version in the modules folder.

If this not a good practice, I hope that someone will let me know. There are a lot of search results regarding how to edit the in Drupal 7. Almost all of the suggestions involve a module or editing the template.php file. I can't see why - editing a copy of html.tpl.php that is in your theme folder works, is easy, and does not involve hacking the core.

nehajn’s picture

In my case drupal 7 with omega sub-theme.
I have included the custom meta tags for a specific node type.
File - preprocess.node.inc

function mytheme_alpha_preprocess_node(&$vars) {
      if(isset($vars['field_media'][0]['uri']))  
      {
        $uri = $vars['field_media'][0]['uri'];  
        $url = file_create_url($uri);  
        $page_keywords = array(
                         '#type' => 'html_tag',
                         '#tag' => 'meta',
                         '#attributes' => array(
                          'property' => 'og:image',
                          'content' => $url,
                            )
                      );
       drupal_add_html_head($page_keywords, 'page_keywords'); 
     }

}

Hope it will helps
sajithathukorala’s picture

Its better to use https://drupal.org/project/metatag module for this not only the description you can add Abstract/Author/Canonical URL/Keywords
which are most helpful for seo.

Rizwan Siddiquee’s picture

Add Meta tags via module check this link

http://www.letmecrazy.com/add-meta-tag-module-drupal-content/

Add Custom(programmtically) Meta tags via module check this link

http://www.letmecrazy.com/add-meta-tags-programmtically-to-custom-page/