Pages

Tuesday, November 1, 2011

Different Meta Description for Posts and Static Pages

How to add meta description and keywords is explained earlier here. Now in this post I would like to describe how to add meta descriptions for different posts and different static pages. Well, now the question is why? Why should we add meta description for individual post? Why not, a single description for all posts. Or, why not a dynamic description for posts?
The posts in a successful blog should be different and unique but the posts should be of particular niche. Consider a blog which is all about blogging; i.e. how to blog, tips and tricks of blog, how to be visible in search engine, search engine optimization etc. All the posts have one thing in common; i.e. 'about blogging'. But all the posts are different and unique. So, a common description is not sufficient for all the posts. One easy solution is to put a dynamic code in the blog which will create different description depending upon the title of the post. But only a part of the description is different. This is not also an efficient solution for a blog to be successful. Each post should have unique description. This method works like a charm and I am sure this is one of the best method towards SEO (Search Engine Optimization). Here is the procedure:

1. If you have already put meta description and keywords in blog for your home page as described in this post.Then delete the same.
2. Now find <b:include data='blog' name='all-head-content'/> using Ctrl+F at your template layout (From Blogger Design -> Edit HTML and Click 'Expand Widget Templates') and paste the following code after that.

<!-- Start of Code -->
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<b:if cond='data:blog.url == &quot;Your post link&quot;'>
<meta content='Post description' name='description'/>
<meta content='Keywords separated by commas' name='keywords'/>
<b:else/>
<b:if cond='data:blog.url == &quot;Your post link&quot;'>
<meta content='Post description' name='description'/>
<meta content='Keywords separated by commas' name='keywords'/>
<b:else/>
<b:if cond='data:blog.url == &quot;Your post link&quot;'>
<meta content='Post description' name='description'/>
<meta content='Keywords separated by commas' name='keywords'/>
<b:else/>
<meta expr:content='data:blog.pageTitle + data:blog.title' name='description'/>
<meta expr:content='data:blog.pageTitle + data:blog.title' name='keywords'/>
</b:if>
</b:if>
</b:if>
<b:else/>
<b:if cond='data:blog.pageType == &quot;index&quot;'>
<meta content='Your Home Page Description' name='description'/>
<meta content='Your Home Page Keywords' name='keywords'/>
<b:else/>
<b:if cond='data:blog.pageType == &quot;static_page&quot;'>

<b:if cond='data:blog.url == &quot;Static Page Link&quot;'>
<meta content='Static Page Description' name='description'/>
<meta content='Static Page Keywords' name='keywords'/>
<b:else/>
<b:if cond='data:blog.url == &quot;Static Page Link&quot;'>
<meta content='Static Page Description' name='description'/>
<meta content='Static Page Keywords' name='keywords'/>
<b:else/>
<b:if cond='data:blog.url == &quot;Static Page Link&quot;'>
<meta content='Static Page Description' name='description'/>
<meta content='Static Page Keywords' name='keywords'/>
<b:else/>
<meta expr:content='data:blog.pageName + data:blog.title + data:blog.pageName' name='description'/>
<meta expr:content='data:blog.pageName + data:blog.title + data:blog.pageName' name='keywords'/>
<b:else/>
<meta expr:content='data:blog.pageTitle + data:blog.title' name='description'/>
<meta expr:content='data:blog.pageTitle + data:blog.title' name='keywords'/>
</b:if>
</b:if>
</b:if>
</b:if>
</b:if>
</b:if>
<!-- End of Code -->
 3. Replace texts in red font color with your own post link, description and keywords.The above code is only for three posts and three static pages only. You can add as many as posts and pages as follows.

4. To add another post just notice the highlighted block. You have to copy the highlighted text and place it immediately below it in two steps. First step is to copy and paste the following:
<b:if cond='data:blog.url == &quot;Your post link&quot;'>
<meta content='Post description' name='description'/>
<meta content='Keywords separated by commas' name='keywords'/>
<b:else/>
and the second step is to again copy and paste the following:
</b:if>
 5. The case is similar with static pages. I hope you can do it on your own. You are done.