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).
Get My Best Internet Marketing and Entrepreneurship Tips
- Don't worry, I only send out emails once or twice a month.
- But when I do, it's because I have something valuable to share!
- You don't want to miss those, and it's completely free!
36 Responses to “Optimize your Meta Description Tag”
great tips… I’ll insert this into my meta tags later..
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.
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.
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?
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!
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.
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.
aha, didn’t think of that. Thanks
Do blog about it?
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.
Code sent via contact form.
Glad I can be of help 🙂 Still very new to blogging to sites like this are a massive help.
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?
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.
Garry, seems to be working on my blog.
Check out the archives.
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.
Hi Garry, my vps went down earlier today.
Check now, it should be up and running.
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.
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.
What do you think about Apple Iogo? >:)
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.
How to do the same on blogger?
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!).
Hi Daniel, I have installed All in One Seo Pack plugin.
Must I replace All in One Seo Pack with this plugin?
How to set meta tag in blogspot template ???
Daily Good Tips
Yes, dynamic is better than static.
Nice article about meta desc … thanks
But what if my front page is static, and it doesn`t have any excerpts or posts. Just static content. How will I display the meta description tags for my homepage then?
I tried using that plugin you recommended, but I only got a
“Fatal error: Call to undefined function head_meta_desc() in /home4/cestitke/public_html/howtocureyeastinfection/wp-content/themes/savana1/header.php on line 10”
Comments are closed.