Monday, October 6, 2008

Adding Meta Description to Each Post on Blogger

because I care

Here is some code that will add the title of the post as it's meta tag description.

Add this to your template right under the <HEAD> tag.

<b:if cond='data:blog.pageType == "item"'>
<meta expr:content='data:blog.pageName' name='Description'/>

Before you mess with your template, you should always save a copy of it first ... just in case.

** I'm thinking if there is an element named pageName there is probably one named body or something similar. From there, it shouldn't be too hard to write some code to feed say, the first 10 - 20 words of your post to the description tag.

If I get around to it, I work on it. I'm not promising anything though. If anyone comes up with it, post it in the comments!

Hat tip: Commenter Dave from this post.

Template provided by Webtalks