Blogspot Tips: The Only Show Post Of ONE LABEL In Home Page Of Blogspot

7:00 AM
--///quang cao tren bai viet ///----

When design blog, you sometime only want to display post of ONE LABEL in Home Page.


Blogspot Tip: The Only Show Post Of ONE LABEL In Home Page Of Blogspot


Characteristics: With this tip, at your home page show only posts of a single label and the posts belong other labels are hidden.

Method only allowing show posts belong a specific lablel in Home Page:


1 Log in into your blog.

2 Select the template => Choose Edit HTML (Edit HTML)

3. Find the code <b:includable id='main' var='top'> and drag the mouse down a few lines you will find similar code as shown below (these code lines might different depending on each blog).

<b:loop values='data:posts' var='post'>

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

<b:if cond='data:blog.pageType == &quot;item&quot;'>

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

</b:if>

<b:if cond='data:post.includeAd'>

<b:if cond='data:post.isFirstPost'>

<data:defaultAdEnd/>

<b:else/>

<data:adEnd/>

</b:if>

<data:adCode/>

<data:adStart/>

</b:if>

<b:if cond='data:post.trackLatency'>

<data:post.latencyJs/>

</b:if>

</b:loop>



4. Replace it into the code below:

<b:loop values='data:posts' var='post'>

<b:if cond='data:blog.url == data:blog.homepageUrl'>

<b:if cond='data:post.labels'>

<b:loop values='data:post.labels' var='label'>

<b:if cond='data:label.name == "Show Label"'>

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

</b:if>

</b:loop>

</b:if>

<b:else/>

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

</b:if>

</b:loop>


Here Show Label is name label that you want to display the article of that label in the homepage.

5. Now, we will find closing tag </b:includable> of <b:includable id='main' var='top'> tag. And put the following code below into AFTER the </b:includable> this closing tag.


<b:includable id='printPosts' var='post'>

<b:if cond='data:post.dateHeader'>

<h2 class='date-header'>

<data:post.dateHeader/>

</h2>

</b:if>

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

<b:if cond='data:blog.pageType == &quot;static_page&quot;'>

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

</b:if>

<b:if cond='data:blog.pageType == "item"'>

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

</b:if>

</b:includable>



6. Finally, save template and checking result.

0 comments