Thursday, 6 November 2014

how to hide specific posts on bloggers home page

This is a step by step guide on how to hide specific content posts from showing on your home page. In this tutorial we will use the "edit html " option.


  1. You first have to label all posts that you don't want to appear on the home page as 

hide.
2.Then Go to Dashboard - Template - Edit Template HTML

3. Place the curser on the HTML page and click cntrl+F and search for <!-- posts -->(note that coding for post ends at the begining of the navigation code. Be sure to save your template before pasting the following code on the post coding)

4. Then highlight the post coding and paste the following code;

<!-- posts -->
<div class='blog-posts hfeed'>
<b:include data='top' name='status-message'/>
 <data:defaultAdStart/>
 <b:loop values='data:posts' var='post'>
<b:if cond='data:blog.pageType == &quot;index&quot;'>
<script type='text/javascript'>var ssyby=&#39;<data:post.dateHeader/>&#39;;</script>
<div class='ssyby-date-outer2'>
<b:if cond='data:post.labels'>
<b:if cond='data:blog.url != &quot;http://yoboy-12.blogspot.com/search/label/hide&quot;'>
  <div class='date-outer'>
   <h2 class='date-header'><span><script type='text/javascript'>document.write(ssyby);</script></span></h2>
   <div class='date-posts'>
    <div class='post-outer'>
     <b:include data='post' name='post'/>
       <b:if cond='data:blog.pageType == &quot;static_page&quot;'>
          <b:include data='post' name='comment_picker'/>
        </b:if>
        <b:if cond='data:blog.pageType == &quot;item&quot;'>
          <b:include data='post' name='comment_picker'/>
        </b:if>
    </div>
    <b:if cond='data:post.includeAd'>
     <b:if cond='data:post.isFirstPost'>
     <data:defaultAdEnd/>
     <b:else/>
     <data:adEnd/>
     </b:if>
      <div class='inline-ad'>
       <data:adCode/>
      </div>
      <data:adStart/>
    </b:if>
   </div>
<b:loop values='data:post.labels' var='label'>
<script type='text/javascript'>
var dhar = &#39;<data:label.name/>&#39;;
if(dhar == "hide" || dhar == "label2"){
document.write(&quot;<div class='hide-climb'/>&quot;);
flag=flag*0;}
</script>
</b:loop>
  </div>
<b:else/>
 <div class='date-outer'>
   <h2 class='date-header'><span><script type='text/javascript'>document.write(ssyby);</script></span></h2>
   <div class='date-posts'>
    <div class='post-outer'>
     <b:include data='post' name='post'/>
      <b:if cond='data:blog.pageType == &quot;static_page&quot;'>
          <b:include data='post' name='comment_picker'/>
        </b:if>
        <b:if cond='data:blog.pageType == &quot;item&quot;'>
          <b:include data='post' name='comment_picker'/>
        </b:if>
    </div>
    <b:if cond='data:post.includeAd'>
     <b:if cond='data:post.isFirstPost'>
     <data:defaultAdEnd/>
     <b:else/>
     <data:adEnd/>
     </b:if>
      <div class='inline-ad'>
       <data:adCode/>
      </div>
      <data:adStart/>
    </b:if>
   </div>
  </div>
</b:if>
<b:else/>
  <div class='date-outer'>
<script type='text/javascript'>var ssyby=&#39;<data:post.dateHeader/>&#39;;</script>
   <h2 class='date-header'><span><script type='text/javascript'>document.write(ssyby);</script></span></h2>
   <div class='date-posts'>
    <div class='post-outer'>
     <b:include data='post' name='post'/>
      <b:if cond='data:blog.pageType == &quot;static_page&quot;'>
          <b:include data='post' name='comment_picker'/>
        </b:if>
        <b:if cond='data:blog.pageType == &quot;item&quot;'>
          <b:include data='post' name='comment_picker'/>
        </b:if>
    </div>
    <b:if cond='data:post.includeAd'>
     <b:if cond='data:post.isFirstPost'>
     <data:defaultAdEnd/>
     <b:else/>
     <data:adEnd/>
     </b:if>
      <div class='inline-ad'>
       <data:adCode/>
      </div>
      <data:adStart/>
    </b:if>
   </div>
  </div>
</b:if>
</div>
<b:else/>
  <div class='date-outer'>
<script type='text/javascript'>var ssyby=&#39;<data:post.dateHeader/>&#39;;</script>
   <h2 class='date-header'><span><script type='text/javascript'>document.write(ssyby);</script></span></h2>
   <div class='date-posts'>
    <div class='post-outer'>
     <b:include data='post' name='post'/>
       <b:if cond='data:blog.pageType == &quot;static_page&quot;'>
          <b:include data='post' name='comment_picker'/>
        </b:if>
        <b:if cond='data:blog.pageType == &quot;item&quot;'>
          <b:include data='post' name='comment_picker'/>
        </b:if>
    </div>
    <b:if cond='data:post.includeAd'>
     <b:if cond='data:post.isFirstPost'>
     <data:defaultAdEnd/>
     <b:else/>
     <data:adEnd/>
     </b:if>
      <div class='inline-ad'>
       <data:adCode/>
      </div>
      <data:adStart/>
    </b:if>
   </div>
  </div>
</b:if>
 </b:loop>
 <data:adEnd/>
</div>
<script src='http://code.jquery.com/jquery-latest.js'/>
<script>
$(&#39;.hide-climb&#39;).closest(&#39;.ssyby-date-outer2&#39;).css(&#39;display&#39;, &#39;none&#39;);
</script>

5. For your posts to be hidden only on your homepage and show them in all other pages with other labels , copy paste the following code on the 10 th line of the above code.

<b:if cond='data:blog.url == data:blog.homepageUrl'>
This will make your posts to be hidden only on your homepage and show them in all other pages.

6. Save your template and you're done

No comments:

Post a Comment