Optimize your Meta Description Tag

The Meta Description Tag (placed between the head and /head tags) is used by some search engines to create the snippets of text that you see right below the results on search queries. It does not carry any weight in the search algorithm of Google, but it does carry a certain weight for Yahoo and other smaller search engines so you should not neglect it altogether.

One problem with the Meta Description Tag of most websites is that it is static. People usually include a general description about the site, which is suitable only to the home page. Should a visitor find an internal page (say a single post) through a search engine the tag will be the same, containing no information about the content of that internal page whatsoever. You can use the SEO tools listed here to check the quality of your meta description tags.

In order to optimize your Meta Description Tag you should make it dynamic, making sure that it will include the first few lines of text of every single page on your site. A very simple way to do this under the Wordpress platform is to make the Description tag equal to the post excerpt, like the code below illustrates.

<meta name="description" content="<?php the_excerpt() ?>" />

Alternatively you can download a plugin called Head META Description. Just upload the plugin, activate it and insert the following line on your header:

<?php head_meta_desc(); ?>

The plugin will generate the Meta Description automatically, either by extracting the first words of your posts or by displaying the post excerpt (you can configure it).

Got the Daily Blog Tips Newsletter?

  • Tips and tricks to improve your site
  • The latest trends and opportunities
  • Useful online tools
  • It's free!

35 Responses to “Optimize your Meta Description Tag”

  1. menghua on January 16th, 2007 10:01 pm

    great tips… I’ll insert this into my meta tags later..

  2. Bes on January 16th, 2007 10:40 pm

    Nice tip Daniel! I always wanted to use the excerpt field in the Wordpress writing editor for something other than photoblog archives. This means some extra work and a little bit more space on the WP database, but it also means a summary for each post on a site that can be displayed in other places too.

  3. Ajay on January 16th, 2007 10:57 pm

    Hi, I’ve found that using the_excerpt tends to break validation on the blog, because WP adds the paragraph tags as well automatically. Not sure why.

  4. Daniel on January 17th, 2007 3:32 am

    Hey Ajay, you are right I had noticed that as well. I guess it has to do the wordpress code, and it would be a mess to create a second excerpt just for the header.

    Do you think the tags on the header can mess something up?

  5. Ajay on January 17th, 2007 3:39 am

    Daniel,

    I don’t think it will mess up your layout, but then again you can’t be sure. Worse thing though is your site doesn’t validate and could mess up bots… again can’t be confirmed.

    I tried using strip_tags around the excerpt but it didn’t work.
    I guess the only option you have is to create a manual excerpt for each and every post.

    It could be additional work here for you but can just about work since your’s is not a personal blog.

    As for me… well I’m stuck with not using it!

  6. Garry on January 26th, 2007 5:05 am

    I created a new function in /includes/template-functions-post.php
    I copied the_excerpt function and renamed it the_metaexcerpt()
    The I found a good striphtml function and added that in, then in the_metaexcerpt function I just put the striphtml function around the content that was being echo’d in the php.

    I tried posting the code here, but it didn’t seem to like it.

    Just remember though that if you update wordpress you’ll lose this function as it’s part of the core files.

  7. Ajay D'Souza on January 26th, 2007 5:12 am

    Hi Gary,

    Any function you can create can be put in functions.php of the theme file. This ensures it remains even on upgrade.

    Can the share the function you created.. the code I mean.

  8. Garry on January 26th, 2007 6:38 am

    aha, didn’t think of that. Thanks

  9. Ajay D'Souza on January 26th, 2007 9:48 am

    Do blog about it?

  10. Daniel on January 26th, 2007 10:04 am

    Gary, send to me the code and I will try to update my post since your method is more effective.

    Thanks for the help man.

  11. Garry on January 27th, 2007 9:43 am

    Code sent via contact form.
    Glad I can be of help :) Still very new to blogging to sites like this are a massive help.

  12. Garry on January 31st, 2007 4:16 am

    I don’t know whether it’s just me being a div, but does the excerpt function work differently in 2.1? Before I was sure I was getting the first few lines of each post, but now I have to actually enter an excerpt for it to display…. anyone else noticing this on their 2.1 blog?

  13. Daniel on January 31st, 2007 4:56 am

    If am not wrong you can force the search results or category-archive pages to get the first few lines of posts even if they have no excerpt written.

    I am not sure how you would do that for the metaexcerpt function though.

  14. Ajay D'Souza on January 31st, 2007 9:13 am

    Garry, seems to be working on my blog.

    Check out the archives.

  15. Garry on February 1st, 2007 1:58 am

    hmmm having some difficulty accessing your site ajay.

    I’ve been looking at some plugins to do the meta bits, so I’ll see how I get on with them.

  16. Garry on February 1st, 2007 2:33 am
  17. Ajay on February 1st, 2007 5:59 am

    Hi Garry, my vps went down earlier today.

    Check now, it should be up and running.

  18. Jamie Boyle on September 16th, 2007 10:50 pm

    Can someone tell me where you put that code, you say after the header???? I not to familiar with that code stuff, could someone write a sample code so i can look in my template, Want to make sure I do this right. Also I use blogger is that compatible with it the download you talked about wordpress.

    Please help, i have one meta tag in my blog at start but when i did another post, i am no longer ranked high.

  19. Daniel on September 17th, 2007 3:14 am

    Jamie, open your Wordpress control panel, then go to “Presentation,” then “Theme Editor”.

    On the right side of the screen you’ll have a list of the files of your theme.

    Open the “Header” or “header.php” file, that is where the code goes.

  20. CandyShopGirl on October 8th, 2007 10:08 pm

    Hola!

    What do you think about Apple Iogo? >:)

  21. SEO Genius on June 10th, 2008 4:34 pm

    Great article, i believe google does not index your pages if they have the same description tags as they see them as the same page.

  22. Adrian Muñoz on July 15th, 2008 3:53 pm

    How to do the same on blogger?

  23. Nicholas Turner on August 8th, 2008 4:44 pm

    Wow, the plugin was very useful. I was tired of all my pages coming up with the default tagline and this seems to have fixed it (at least when viewing the source). I’ll have to wait and see what Google does with it to see if it really works. Thanks for the very useful information (and plugin link!).
    – Ourlullaby.com

  24. Syahuri on January 8th, 2009 9:10 am

    Hi Daniel, I have installed All in One Seo Pack plugin.
    Must I replace All in One Seo Pack with this plugin?
    :D

  25. Bang Kritikus on January 27th, 2009 1:53 am

    How to set meta tag in blogspot template ???

  26. Daily Good Tips on May 26th, 2009 11:10 am

    Yes, dynamic is better than static.

  27. Vhalala on June 13th, 2009 6:07 am

    Nice article about meta desc … thanks

Got something to say?





Sponsors

Why I recommend Doreo Hosting Flex Theme for WordPress Content rich web directory Ghost Writing Services Online Invoicing For Freelancers advertise here

Recent Articles