Wednesday, October 27, 2010

Show Only Post Title In Blogger Label-Archive-Home Pages

How to Show Only Post Title In Blogger Label page,Archive Pages or even on home page of your blog.You sure would have seen many blogs using this trick to show only there post title in any page they want.Wordpress blogs easily do this using various plugins available but we bloggers also now can make it work in our blogs as its very simple tutorial to implement.
Here is an hack how to show post title in any desired page of an blog.

Please Read this tutorial very carefully as it is very easy but i am telling you two ways of doing which have different results.You can use one way at time or both ways at time but results will be different.I will try to make it very simple for you with what would be the result to the blog with each step, so read carefully.

1.Login to Blogger
2.Go To LAYOUT
3.Then Click On Edit HTML
4.Check Mark Expand Widgets
5.Press Ctrl+F

Now search For below code:

<b:include data='post' name='post'/>

And Replace it with Below Codes:

<b:if cond='data:blog.homepageUrl != data:blog.url'>
<b:if cond='data:blog.pageType != "item"'>
<h3 class='post-title'><a expr:href='data:post.url'><data:post.title/></a></h3>
<b:else/>
<b:include data='post' name='post'/>
</b:if>
<b:else/>
<b:include data='post' name='post'/>
</b:if>

Now open your blog and click on the label or archive page of your blog it will show only post title . For demo check the category page of this Blog.

I hope you will be satisfied with it.This is one way.

Now there is another way of doing it but the results are different.

If you want to show only title of posts in your blog home page also,then only follow this way and implemet it.If you want only label page to show post title just get stoppd after reading first way only.

Now the second way to show only post title in blogger home page too.

1.Login to Blogger
2.Go To LAYOUT
3.Then Click On Edit HTML
4.Check Mark EXpand Widgets
5.Press Ctrl+F

Now search for this line:

<p><data:post.body/></p>

After finding this line replace it with below codes:

<b:if cond='data:blog.pageType == "item"'>
<p><data:post.body/></p>
</b:if>

This will show only post title on all pages of blogger including homepage label and archive pages.
One of my reader asked to show post title only in archive pages so i am placing code for him
Just use these codes to replace the above red line in place of above codes.

<b:if cond='data:blog.pageType == "index"'>
<p><data:post.body/></p>
</b:if>

And if you dont want to use post titles in archive pages use archive in place of index in above codes that's the only word making basic difference between the codes.

*Note-If you are using read more hack in your blogger you will get above red line twice.So replace only the line that appears first in your blog html code and leave second one as it is.

And then preview your template,if its ok. Save It.

The result would be like this in your blog.
...

Source:
http://www.anshuldudeja.com/2009/03/show-only-post-title-in-blogger-label.html

0 comments:

Post a Comment