Southern Listeners

Loading
Thanks to Greenlava for this cool gadget. Get yours here

Monday, August 22, 2011

Hide Certain Posts from Blogger Homepage


It took me forever to come up with this one. But judging from the length of the code I've posted here, you should be able to tell how hard it was to come up with this one. First thing first - I will be seriously pissed if you try to copy this post, I mean it.

Now, back to the actual post. It has been a popular question/request from many bloggers - how to hide some posts from appearing on Blogger homepage? And now, with the help of labelled filters, you can actually do so. In other words, by labelling your posts 'hide', you can actually hide your post from ever seeing the light of your home page. And -- you can still view the post if you click on your archive or that 'Older post' or 'Newer post' link, or by accessing the post page directly via its URL, among other ways.

Note: I've also included my other famous tweak - 'show date for each post' - in this tutorial. It was necessary. For those of you who have inserted the code to show date for each post from my previous tutorials (link here and here) and want to try this week's tutorial, kindly reverse the steps and remove the old tweak before attempting this week's tutorial.

Update: The tweak has been updated. You can now assign more than a label to the post that you wanna hide. As long as it contains the label 'hide', your post will be hidden!

Step 1:

Backup your template before attempting this tutorial. Next, find for your template's HTML.

In old layout: Go to Dashboard - Design - Edit HTML - Expand Widget Templates.
In new layout: Go to Dashboard - Template - Edit Template HTML - Expand Widget Templates.

Next, find and delete the following lines:
<!-- posts -->
    <div class='blog-posts hfeed'>

      <b:include data='top' name='status-message'/>

      <b:loop values='data:posts' var='post'>
        <b:if cond='data:post.isDateStart and not data:post.isFirstPost'>
          &lt;/div&gt;&lt;/div&gt;
        </b:if>
        <b:if cond='data:post.isDateStart'>
          &lt;div class=&quot;date-outer&quot;&gt;
        </b:if>
        <b:if cond='data:post.dateHeader'>
          <h2 class='date-header'><span><data:post.dateHeader/></span></h2>
        </b:if>
        <b:if cond='data:post.isDateStart'>
          &lt;div class=&quot;date-posts&quot;&gt;
        </b:if>
        <div class='post-outer'>
          <b:include data='post' name='post'/>
          <b:include cond='data:blog.pageType in {&quot;static_page&quot;,&quot;item&quot;}' data='post' name='comment_picker'/>
        </div>

        <!-- Ad -->
        <b:if cond='data:post.includeAd'>
          <div class='inline-ad'>
            <data:adCode/>
          </div>
        </b:if>
      </b:loop>
      <b:if cond='data:numPosts != 0'>
        &lt;/div&gt;&lt;/div&gt;
      </b:if>
    </div>

Step 2:

Copy and paste the following lines in place of the deleted lines in Step 1 - then click on 'Save Template':
<!-- 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>
The code in place (starting portion)


The code in place (ending portion)



Step 3:

Go to Dashboard - Settings - Posts and Comments - Show at Most - And set to 50.



Step 4:

You're already done! To hide a post from your main page, just label it 'hide'. And you can add other labels to your post if you want.


You can customize the label from 'hide' to a text of your own by changing line 38 in the code above. Enjoy folks!

Extra #1) Show All Hidden Posts in a Single Label Page

You might want to hide some of the posts from your home page, but show the posts when you click on the 'hide' label page, or whatever label name you choose for this purpose. To enable this, all you have to do is change the URL in line 10 in the code given in Step 2. You need to replace the URL above with the URL of your hiding-label page. You can find out the link to your hiding-label page by clicking on the hiding-label from your label's gadget. For example, if you decide to use the 'hide' label as your hiding-label (boy this sounds confusing, but it is not!), simply click on 'hide' from your 'Label' gadget and you shall get the address of your hiding-label page.

This will be useful if you intend to make use of the label page's URL to categorize your post. Let me just give you an example. At the top of this blog, in my menu, I have a link to my 'Transformers' posts. All the posts that have the 'Transformers' label are grouped there. Each time I use this label, the post will appear in that link, as well as my homepage. If I want these posts to just appear in the link in my tab, and not my homepage, all I have to do is change the label address in line 10 to point to my 'Transformers' label address.

Important Note: You can't use a country specific URL in Line 10. In other words, the URL in Line 10 has to be either 'blogspot.com' or your custom domain URL. For example, if your label's URL is as such:
http://yoboy-12.blogspot.co.uk/search/label/hide
You need to get rid of the country-specific code next to 'blogspot.' and leave the URL in its original .com state, as such:
http://yoboy-12.blogspot.com/search/label/hide

Extra #2) Show All Hidden Posts in Multiple Label Pages

If you assign more than one label to your hidden posts, say 'Hide', 'Transformers' and etc, and you want your posts to be shown in all these label pages, all you need to do is replace Line 10 with the following:
<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.

Extra #3) Margin Fix:


1) If something seems off with the way your posts are arranged in your homepage, fear not. Simply add the CSS code below and things will be fine again.

In default layout: Go to Dashboard - Design - Template Designer - Advanced - Add CSS - paste the following code - Press enter after the last character of the last line } - Apply to Blog.

In new layout:
Go to Dashboard ('House' symbol) - Template - Customize - Advanced - Add CSS - paste the following code - Press enter after the last character of the last line } - Apply to Blog.
.ssyby-date-outer2 .date-outer {
position: relative;
margin-bottom: 65px;
}

.ssyby-date-outer2:last-child {
margin-bottom: -45px !important;
}
Change the value '65px' accordingly.

2) If you notice a weird margin issue in Internet Explorer alone, try the following fix instead.
*+html body .main-inner .column-center-inner {
margin-top: 0px !important;
}

Took me forever to come up with this one. Simply the hardest tweak I've come up with. Hope you guys find it useful. Cheers.

342 comments:

  1. @Chankey: You're welcome. Cheers.

    ReplyDelete
  2. AWESOME, dude! I will definitely be using this one. :)

    ReplyDelete
  3. @GJE: Glad to hear that. Cheers.

    ReplyDelete
  4. Okay, now how do we hide the "HIDE" tag from the labels list? :)

    ReplyDelete
  5. @GJE: Glad you asked. Let's save that for another tutorial. Hopefully I'll find the time to write a post on hiding certain labels from the label gadget sometime next week. It's really going to be a challenge with me working 6 days a week, moving to a new house and going to be internetless for more than 10 days in my new place.

    ReplyDelete
  6. Wow. This is totally not working for me. I'm kind of stuck at Step 1! Is that possible?

    ReplyDelete
  7. @GJE: What seems to be the problem?

    ReplyDelete
  8. Oh my God! Genius!!! Worked!!! Thank you very much!

    ReplyDelete
  9. @Harada10: Appreciate the feedback. Thankss..

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Oh, its all there... except there is this white space with no post. So now the looks become like this : page1 was white, page2 have 3 posts, page3 also white, page4&5 have 1 post, page6 also white, page7 have 4 posts.
    I choose to show 5 posts per page and also using "readmore summary hack with image thumbnail".

    ReplyDelete
  12. I forgot to tell that I'm using "Memoranda" templates right now. I also tried with other templates like "Article", the result is fine with no blank space..So it must be because of the templates i'm using right now.

    ReplyDelete
  13. @Noname: Thanks for the feedback. I had not the chance to test the tweak across multiple templates. But I did test the tweak on all Designer templates, and I've added mods to make sure it works on all Designer templates.

    ReplyDelete
  14. I tried again with "Memoranda" templates complete with all its scripts & css in a different blogs (with different posts & labels) and this time its working. I wonder if it have anything to do with my post or label name? here is my blog link : http://testtempt.blogspot.com/

    ReplyDelete
  15. @Noname: Could be a glitch. Should have mentioned this earlier. The post that you're hiding should not contain any other labels, except for the triggering label.

    ReplyDelete
  16. Here is the picture result https://lh4.googleusercontent.com/-UkWByas10ss/TnlUTHUqPdI/AAAAAAAACek/OmfLz_UUQ7o/s912/picture%252520result.png. I have all 290 posts with 200 posts (5 labels to hide). The after results leaving my homepage with an empty page randomly.

    ReplyDelete
  17. @Noname: That shouldn't be happening. Do you have an actual URL I can have a look at? Anyways, this tweak has been optimised for designer templates. Third party templates are built on lots of different features. At such, it was difficult to come up with a tweak that will work on all template. But I'm happy to have a look at your template and see if there's anything that can be done to make the tweak work. I've downloaded the Memoranda template, and I've tested the tweak. And it worked. I coudlnt see the empty pages that you were seeing. Leave a link to the page that you're seeing, and I'll have a look.

    ReplyDelete
  18. @Noname: Noted. I'd like to inspect your template, and try to replicate the issue, to see if I can come up with a work-around for this particular template. Go to Dashboard - Design - Edit HTML - Download Full Template - Save the resulting xml file somewhere in your computer. Then go to www.rapidshare.com and upload your xml file there. You will be given a link. Come back to this thread and leave your link here.

    ReplyDelete
  19. @Noname: You're right. The auto-pagination is causing this, added with the fact that you have more posts to hide than display. There's nothing much can be done about this, as it is very difficult to control auto-pagination.

    ReplyDelete
  20. This is great. First solution I've found that actually works. Still, when I try to visit the label link for the "hide" label, it shows no posts. I am trying to achieve the same effect as what you described with your Transformers example. Any ideas?

    ReplyDelete
  21. @SG: Thanks for pointing this out. I had to remove this feature to make way for another basic feature. But I've revised the tutorial and this feature is back in. Simply replace Line 12 with your label page's address. Unfortunately, the tweak can only accommodate one label page for the moment. I'll see if I can tweak the code to include mode label pages, in the future.

    ReplyDelete
  22. hi nice post. i have tried with above steps.it worked with hiding the post of certain labels.but unfortunately the other post in home page are showing twice. can you please tell me the reason

    ReplyDelete
  23. hi nice post. i have tried with above steps.it worked with hiding the post of certain labels.but unfortunately the other post in home page are showing twice. can you please tell me the reason

    ReplyDelete
  24. @Anon: I'll have to have a look. But if I have to guess, I'd say the other post that is repeating twice might have other labels in it, together with the hiding label. If you're applying the hiding label to a post, make sure no other label is applied to that post. Just see if this is the reason.

    ReplyDelete
  25. Nice article.
    It certainly hid the "hide" labeled post.
    Problem is, other posts are showing up on the main page multiple times.
    Can you please look in to this.
    Thanks.

    ReplyDelete
  26. nice nice nice! :) works fine!

    ReplyDelete
  27. @//Sub/Corpus: The other post that is repeating twice might have other labels in it, together with the hiding label. If you're applying the hiding label to a post, make sure no other label is applied to that post. Just see if this is the reason.

    @Anon: Glad it works. Cheers.

    ReplyDelete
  28. So I think I've isolated the repeating post problem. For posts that are not being hidden, if they have multiple labels, they are posted as many times as the labels that they have. For example, if one post has five labels, then it is posted one time. If it only has one label, it will only post once. Is there a way to modify the code to account for this problem?

    ReplyDelete
  29. @SG: It is of no surprise. I did mention about this in Step 3. I'll see if it can be avoided. But when I was writing the code, it was really tight and I doubt if there's any room for improvement. I'll re-dive into the coding and see if I can make any changes.

    ReplyDelete
  30. great tutorial man. it worked just great n tnx 4 putin everythin in an eary way

    ReplyDelete
  31. @Justion: Don't I just love to see a comment like yours early in the morning :) Thanks mate.. Cheers.

    ReplyDelete
  32. thx .. i can hide my post now .. tat's all wad i need .. really thx u ^^

    ReplyDelete
  33. @April: Glad you like it. Cheers :)

    ReplyDelete
  34. @Amazing World: You're most welcome :)

    ReplyDelete
  35. I have a different html template....how to rearrange it...please help....below is my template

    http://hotfile.com/dl/137632645/bbf0d58/template-5125324495784758422.xml.html

    ReplyDelete
  36. @Anon: I'm sorry. I've had the intention to do this for months before finally getting an idea on an actual implementation, and few further weeks developing, testing and troubleshooting the code - all these on a standard template. It will take way too much time to implement the same on custom templates. If you couldnt find any similar code like the ones shown above in your template (it doesnt have to be identical), then I'm afraid there's nothing much I could do to help you. All the best :)

    ReplyDelete
  37. i will be you code soon, thanks again yoboy..

    ReplyDelete
  38. @firdaus: Do let me know how it goes :)

    ReplyDelete
  39. hi yoboy, can you develope a code that can display all post in some page and hide on homepage.

    i mean like this (example)
    www.southernspeakers.net/p/blog.html

    all post display on that page..

    thank you

    ReplyDelete
  40. @Firdaus: Unfortunately, it is not possible to publish posts to static pages, as posts are dynamic in nature. The two just can't work together. But on a positive not, you can use the label address to display all your hidden posts in one single link. See the "Show All Hidden Posts in Label Page" section above. You can then use this link and include it in Pages gadget or something, and it would appear as if all these hidden posts are published in a separate page - but in reality they are just displayed in a label page :)

    ReplyDelete
  41. Hi YoboY, is there a way to do this in Dynamic Views? Seeing as we can't edit HTML yet, it seems impossible!

    ReplyDelete
    Replies
    1. Not at the moment there isn't. Let's have our fingers crossed :)

      Delete
  42. hey, i used the tweak and now before hiding each and evry article is repeated 5 times. what to do?

    ReplyDelete
    Replies
    1. I can't find any repeating articles in your blog. In any case, if you think something has gone wrong in your blog, use the backup that you've created in Step 1 to restore your blog to its working state prior to the tweak.

      Delete
  43. It doesn't work for me! Some help http://zombieddon.com Check out the source and tell me what can I do! Thanks a lot!

    ReplyDelete
    Replies
    1. You're using a third-party custom template. The structure of your template is unfamiliar for me, thus it'll take me ages to implement the trick in your template. Contact the author of your template, and see if he/she could integrate the trick in your template's structure.

      Delete
  44. Hmm...I looked through all the comments...I don't understand what I'm doing wrong.
    Same problem as other people have had--non-hidden posts show up multiple times--yes, they have multiple labels but not the "hide" label. Is this just how it is and there's no fix?

    ReplyDelete
    Replies
    1. It's hard to tell what might have gone wrong. Mind if I take a look at your blog?

      Delete
    2. It's trinityvalleybeekeepers.blogspot
      Still a work in progress.

      I really appreciate your blog and all you do. I looked at it all the time while making my personal blog. I think your blog is the best blogspot tutorial one out there!

      Delete
    3. Hi Vanessa,

      It is still pretty hard for me to figure what went wrong. If you don't mind, can I have a look at your template's code? Here's how. Go to Dashboard - Template - Backup/Restore - Download Full Template - Save the resulting xml file somewhere in your computer. Then go to www.rapidshare.com and upload your xml file there. You will be given a link. Come back to this post and leave your link here.

      Delete
    4. Hi Vanessa,

      I'll have a look at your template. You can delete the file from rapidshare.

      Delete
  45. I messed around with it for a while too without any luck. :(

    ReplyDelete
    Replies
    1. Fixeed it :) I've updated the tutorial above. It should work fine now. Many thanks to you for spotting this bug!

      Delete
    2. Thank you so much--it works now!!

      Delete
    3. No, thank YOU for spotting the bug and not giving up :) Cheers~

      Delete
  46. Thank you for the post one question. You say to change line 12 label address, but I don't see what your talking about to change in line 12.

    ReplyDelete
    Replies
    1. Ah, sorry. I've updated the code, but I forgot to reflect it in the instruction. Should be Line 10.. If you wanna access all your hidden labels in one page, you need to update Line 10. Sorry about that..

      Delete
  47. My posts that have the hide label don't show up on the hide label page. Any thoughts, I changed line 10.

    ReplyDelete
    Replies
    1. Hi Enick,

      Allow me to have a look at your template. Go Edit your template - Click on 'Expand Widget Templates' - Copy everything and paste it at www.pastebin.com. Get back to me with its link.

      Delete
  48. Hi Yogaratnam,

    I appreciate you looking at this thank you. Below is link.

    http://pastebin.com/SAUg9jaA

    Thank you

    ReplyDelete
  49. Hi Enick,

    Change Line 10, from this:
    <b:if cond='data:blog.url != &quot;http://nowitmakescents.blogspot.com/search/label/hide/search/label/hide&quot;'>

    to this:
    <b:if cond='data:blog.url != &quot;http://nowitmakescents.blogspot.com/search/label/hide&quot;'>

    Let me know how it goes..

    ReplyDelete
  50. @Yoboy, So check this out...I'm trying to get 1 post to not show in the home page but show in our "About Us" page. My pages are linked to labels, so in other words when I create a post I add a corresponding label. The post will show in the Home page and About Us page. I want it to show in About Us, but NOT in the home page. (and not just hide it, but not post to home at all...I have a video with auto-play attached and when I tried to hide it, the post doesnt show, but I can still hear the video playing lol).

    Osgoode.

    ReplyDelete
    Replies
    1. Hi Osgoode,

      Unfortunately, we can only go as far as to hide the posts. It is technically impossible to load blog posts selectively from the post feed. All posts will get loaded, we can only hide it.

      Delete
  51. You are the fucking man. Thanks so much for your hard work!

    ReplyDelete
  52. Hi Yoboy,

    I think I have done everything right to hide my posts and this seems to be working for home page. The only thing now is I can't figure how to make the post I want to appear in my link as you did in your transformer label? Can you help? I can't seem to make this work in line 10. I feel I am missing a step here.

    ReplyDelete
    Replies
    1. Hi Anon,

      What address are you entering in Line 10?

      Delete
  53. Yoboy,

    This is the address I am entering in Line 10:


    The hide label lists on the sidebar when I post but I can't get the information to post to my separate blog page. When I take out hide and just label it as blog it posts to the home page but this is not what I want.

    Thanks for your time. I really appreciate your help.

    ReplyDelete
    Replies
    1. Hi Anon,

      I couldnt see the address in your previous comment. Got left out somehow?

      Delete
  54. Sorry,

    Here is the address in line 10.



    Thanks,
    Allison

    ReplyDelete
  55. daughtersofdivinecharacter.blogspot.com/p/faith-writer-blogs.html/search/label/hide&quot;'>

    ReplyDelete
  56. It should be: <b:if cond='data:blog.url != &quot;daughtersofdivinecharacter.blogspot.com/p/faith-writer-blogs.html/search/label/hide&quot;'>

    If this is what you have in your blog, and if it still isn't working, I'm gonna have to inspect your blog to see why it isn't working.

    ReplyDelete
  57. Yes this is what I have in my blog with http:directly in front of daughtersofdivinecharacter.

    Can you check this out for me?

    ReplyDelete
    Replies
    1. I'd be happy to. But your blog is set as private.

      Delete
  58. The blog page is still in the making but I changed all the settings to public view.

    Thanks

    ReplyDelete
    Replies
    1. Hi Allison,

      This is what you should be using for your Line 10:

      <b:if cond='data:blog.url != &quot;http://daughtersofdivinecharacter.blogspot.com/search/label/hide&quot;'>

      All the best!

      Delete
  59. OMG..I can't believe it worked. Now I can move forward. You are awesome and best tutorial. I've been struggling with this issue for past 4 weeks. Donate button is a great way to express my thanks. This is priceless.

    Thanks so much for your time and patience!

    ReplyDelete
  60. Yoboy,

    One more thing? How do I get the top tabs to link to the posts I click on them?

    Thanks

    ReplyDelete
    Replies
    1. Hi Allison,

      Glad you got it working.

      I don't quite get your second question. Are you referring to the Pages gadget? You can add a link to it by going to Dashboard - Pages - New Page - Web address. Is this what you're looking for?

      Delete
  61. Yes. This is what I was looking for. Everything is working perfectly. I Don't know how you came up with the hide code but this is superb work! Great job!

    ReplyDelete
    Replies
    1. That's great! It took almost 8months to come up with a working bug-free solution for this tweak. Glad you find it helpful :)

      Happy blogging!

      Delete
    2. Hi

      Is it possible to Hide one or more Links in a blogpost and unhide it if someone post a comment ?

      Delete
    3. Hi JediMind,

      The algorithm for that will be too complex, and it might require a complete overhaul of the template. I don't see a way to pull it off.

      Delete
  62. You are amazing!!!

    ReplyDelete
  63. Bummer but thx for the replay.

    cheers

    ReplyDelete
  64. Thanks to this post. do you have demo on this? i want anything appear in my homepage would disappear excluding my sidebar widgets.. Because i have plan to put my LABEL THUMBNAIL in my homepage.. so that they can directly click to what category they are going to read.

    awaiting respond,
    Marky

    ReplyDelete
  65. its not working.. i've tried and re do it. But nothing happen.

    ReplyDelete
    Replies
    1. Hi Mark,

      I don't have a demo running right now, but it is still working. Plenty of readers reported success in comments above, check out one of their blogs. What is your blog's address btw? I could have a look and try to see why you're not seeing anything.

      Delete
  66. Hi, Yogaratnam.
    Thanks a lot for your tweak, although I can't seem to get it working fine: all the posts I want to hide are hidden even in the 'hide' label page. I changed line 10 of the code to point to that adress but it changes nothing. I don't know what I'm missing.

    ReplyDelete
    Replies
    1. Hi Info,

      Can I have a look at your Line 10? Just copy and paste it here, in the comments. You might get a warning for trying to post HTML in comment section. If that is the case, just remove the '<' and '>' from the line before publishing your comment.

      Cheers.

      Delete
    2. Here it is:


      b:if cond='data:blog.url != "http://xerodermap.blogspot.com.es/search/label/participacion"'


      my filterling label is supposed to be "participacion" (which I changed in line 41), and the posts labelled "participacion" are only due to be shown on the address shown at line 10...

      Again, thanks a lot.

      Delete
    3. This comment has been removed by the author.

      Delete
    4. This comment has been removed by the author.

      Delete
    5. I found out what it was...

      Since my site is a Spanish site, it's URL is http://xerodermap.blogspot.com.es. When I write the url I want my labeled posts to appear I put http://xerodermap.blogspot.com.es/search/label/participacion. That doesn't work out at all. I simply erased the Spanish suffix .es and (http://xerodermap.blogspot.com/search/label/participacion) it did the trick.

      So in case anyone else comes out with this problem you have the answer...

      Thank you very much again for your patience

      Delete
    6. Hi Rodrigo,

      I was gonna suggest you the same, I've seen this problem before. Apparently, the URL direction doesn't work all the way to its core. So in conditional HTMLs you still need to use your original URL. Glad you solved the issue. Happy blogging! :)

      Delete
  67. Thanks,

    I was wondering if the tweak can be applied to several sideblogs. So far I've tried to paste the script again inside the same "posts" section of the code, but it worked partially. It filtered correctly the posts on either sideblog, but it duplicates non filtered posts inside the main page. I guess I shouldn't be pasting the same code twice, but then again, when it comes to javascript or .html I'm completely dumb.

    Thanks in advance

    ReplyDelete
    Replies
    1. Hi Rodrigo,

      What do you mean by sideblogs? Whatever it is, repeating the code might not be a good idea.

      Delete
  68. Hi Yoga,

    The idea I'm working on is using two (or even three) virtual static pages where I classify my posts by labels. I followed your tutorial about virtual static pages and I can manage that without a problem.
    I just don't want those classified posts to appear on my home page. I also followed your tutorial without a problem. but,... since I'm filtering post from 2 or 3 different categories and on line 10 of your code there's just space for 1 url where posts are not hidden, how could I do to add the other urls inside the code, so that the other filtered posts don't remain hidden?
    I'm sorry to be such a pest. I'm trying to develop a non-profit social help site and I'm very low on resources. I just have friends' help and people like you. Thanks again for your unlimited patience.

    ReplyDelete
    Replies
    1. Hi Rodrigo,

      I get what you mean. You need to add a line similar to line 10 for each one of your labels. Follow the steps below:

      1) Copy and paste Line 10 directly below it, and adjust its address accordingly (this should be your new Line 11).

      2) You need to close the conditional statement by making a copy of Line 76 and paste it directly below it (the like that says b:if)

      3) Repeat steps 1 and 2 for any additional labels that you might have.

      Hope this helps :) Cheers!

      Delete
    2. I found out about it. I'm awesome too!
      The solution for me comes when you copy the code from lines 10 to 76 (one for every page you want to place post that are hidden from your homepage).
      Those posts should have two labels: 1) label 'hide' or whatever you may call it and 2) the specific label you want to use to filter your posts to a certain virtual static page.

      The rest of the posts should only have one label. This is important beacuse the many labels they have, the many times you are going to find the repeated in your homepage.
      I found out this by trial and error, but it's working fine now for me.

      Hope this helps, and super-extra-big thanks for your help!


      You can check it out at: http://xerodermap.blogspot.com

      Delete
    3. That's great! Happy blogging :)

      Delete
  69. Hi bozzz,
    thanks for tutorial in its work on my blog, but I have other thing related that I can't solved.
    How if I put my post to more than 1 label, 1st in "hide" label 2nd in "game" label. the problem is I can appear my post in "hide" label but I cant see in my "game" label. how to solve it.
    I want to appear my post on label page. as you mentioned in "step 4" we can put more than one label,

    thanks,

    ReplyDelete
    Replies
    1. Hi mbahtokek,

      1) First, change 'label2' from line 41 to 'game'.
      2) Next, duplicate Line 10, by copying and pasting directly below itself.. The address should reflect the address of your game label.
      3) Duplicate Line 76 by copying and pasting directly below itself.

      Cheers and Good luck!

      Delete
  70. Hi..This really works with my blog..but I think it affects my slides, Is there a way to hide post and doesn't affect the slides? Thanks..

    ReplyDelete
    Replies
    1. Hi BK,

      To be honest I'm surprised it even works in third party templates. I'm afraid there's nothing much I could do to help since your template is structured in a way that I'm not familiar with. Perhaps you could try contacting your template maker and see if there's any way to make your slides work.

      Delete
  71. I know that this is probably not possible in blogger but what if dont want to particularly hide my blog post but have show up kind of like these post do: http://momandwife.com/blog/
    with the snippet of the text content and the same sized image beside with "read more" link after the snippet? That blog link I shared is from wordpress and I really have not seen anything like that on any blogger post so I would understand if its not possible. Just putting it out there is case of possibilities. I know you can cut your post on blogger and have it show part but not all of the post in the home of the blog. The thing I am trying to achieve is the uniformity of this listing, if you click on one of the links on that URL above you can see that the images are larger and not really aligned that way, I guess is like a template or something?
    Please let me know:)

    ReplyDelete
    Replies
    1. Hi Charlotte,

      There are lots of websites that provide the code to do what you're asking for. Too many sites till I decided not to write a tutorial on it here in Southernspeakers :P Here's one you could use:
      http://www.bloggersentral.com/2009/11/blogger-auto-read-more-with-thumbnail.html

      Cheers :)

      Delete
  72. Thank you sooooo soooo much, this is exactly what I've been looking for! I also had troubles with the country based URL and you guys simply solved my problem :) Awesome work!

    ReplyDelete
    Replies
    1. Glad things worked out smoothly for you :)

      Delete
  73. Thanks for updating with tweak with changes in threaded comments :) :) You are awesome

    ReplyDelete
    Replies
    1. And thanks to you for noticing the bug :) Appreciate it.

      Delete
  74. That's great! Only one little thing: in order to change the label name line 41 is now 46.

    Thank you for your skills.

    ReplyDelete
  75. Hello thanks for ur code thats most helpfull in my blog, But i have only 1 prob in "Show All Hidden Posts in Label Page" thinky.
    i replace ur url(http://yoboy-12.blogspot.com/search/label/hide) with my to show as u say my hiddenpost in labbel but not working is still hiden. i replace it with my hide link from labels, but is still hiden.

    plz can u help me? realy important for my blog
    Thanks

    ReplyDelete
    Replies
    1. Hi Anon,

      What is the address that you're using to replace Line 10?

      Delete
  76. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Hi JM,

      That's great.. I've known about the country-specific redirect issue, just havent found the time to properly update this post.. Perhaps I'll add a footnote.

      As for more than 1 link, it is possible.. Here:

      1) Copy and paste Line 10 directly below it, and adjust its address accordingly (this should be your new Line 11).

      2) You need to close the conditional statement by making a copy of Line 86 and paste it directly below it (the like that says b:if)

      3) Repeat steps 1 and 2 for any additional labels that you might have.

      Delete
  77. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Hi JM,

      That ain't right.. Ending the condition at Line 122 might bypass some label checks, causing hidden posts to appear in the homepage. Anyhow, I'm sorry for my earlier info. The info that I gave you was for the old code that I had. I've tested it again, and it seems like the new code will increase more than twice if we wanna add another hide link. It's gonna slow down your blog's load speed. I think it is best if you stick with a single hide link. Sorry bout this..

      Delete
  78. This comment has been removed by the author.

    ReplyDelete
  79. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Don't you think its kinda obvious to delete posts that we do not need instead of hiding it? Using the tweak in its original form, tagged posts will be hidden from the homepage, and NOT everywhere as you're claiming. You can still access the post using its directlink, or the label's link, or the archive gadget, or the label gadget, next/previous post, linklist etc.

      Label link wise, as I've mentioned earlier, the code will get too complex if we wanna do it for two links. But if you want the posts to be hidden only on your homepage and show them in all other pages, there's an easier way to do so. Replace Line 12 with:

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

      Delete
  80. when i do that u say to replace line 12 with that then error and cant save!

    ReplyDelete
  81. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Ahhh, I'm extrremely sorry! I meant Line 10, not 12.. Replace Line 10 with the code that I gave u in my previous reply.. Let me know how it goes!

      Delete
  82. working fine thank you! :)

    ReplyDelete
  83. I need ur help once again,
    i want to hide or not display this navigation page from my homepage only.! (http://onlinepctrick.blogspot.gr/2011/11/awesome-page-navigation-for-blogger.html)
    Can u help me if u can plz? :)
    how to hide it from my homepage only!

    ReplyDelete
    Replies
    1. Hi Anon,

      You sent me a tutorial page. Where can I see this navigation page that you're referring to?

      Delete
  84. I have a simple blog template but I've done a lot of custom HTML work on it. When I plug in this code it hides everything from my sidebar and posts. Any ideas why it would be doing this?

    ReplyDelete
    Replies
    1. The tweak in this page will replace a portion of your HTML with a different one that allows posts to be hidden. If you've done customisation on the old set, you'd have to redo it again in the new one. What exact customisations are we talking about here? What's your blog's address btw?

      Delete
    2. lovegrowsdesign.com. i've done a lot as you'll be able to see. removed the date header, manually removed labels, adjusted sizes, removed "show labels..." message, to name a few.

      Delete
    3. Most of what you've changed are CSS tweaks.. CSS tweaks will not be affected by the tweak in this tutorial.. In any case, if you're certain if you've applied HTML tweak to your previous template, I recommend you restore your template to its original state using the backup from Step 1, and try to track back what are the changes that you've done..

      If the code that you removed in Step 1 is identical to the code that I've shown above (in Step 1), that means you have not done any HTML changes, and there might be some other reason why your custom tweaks are missing.. In other words, if you're certain you've made HTML tweaks to your template's body, the code I've shown in Step 1 above should not be the same (as for line-by-line) with the almost-similar code that you might find in your template. You can use that as a guide to note down the changes that you might have done to your template.

      Hope this helps. Let me know if there's anything I can do to help. Cheers :)

      Delete
    4. yay!! little tweaks here and there and it works! thanks so much! i've seriously been trying to figure this out for ages!

      Delete
    5. So glad to hear that! Don't forget to keep a backup copy of your up-to-date working template :)

      Cheers and God bless..

      Delete
  85. Hey this doesnt seem to be working for me, im using a standard template called awesome, but the code that needed deleting was alot smaller than on the guide, i deleted it and copied in your code but it didnt work?

    ReplyDelete
    Replies
    1. Hi Ryan,

      I've just re-tried this tweak on an Awesome Inc template, and it is still working. Perhaps you've deleted a wrong set of code for your Step 1. The code that you need to delete is shown in Step 1, line-by-line, all of them.. Be noted that in your template, you'd find multiple instances of the line that says ''.. Look for the right one.. It should be identical to the lines posted in Step 1..

      Delete
  86. Ah yeah there was two instances i deleted the first one, cheers! question though when you do this hide feature, does it count them towards the 50 that can be shown on the main page, if so how do you get around that?

    ReplyDelete
    Replies
    1. Hi Ryan,

      I'm afraid hiding the posts doesn't prevent the post contributing to auto-pagination, so yes, it still does count towards your post-limit.. There isn't much we can do about it..

      Delete
  87. Oh this didnt have the desired effect i wanted, i wanted so i could hide posts from the main page but label them aswell so i could make a label list, so it would appear this posts are being posted to a different page, but they arent coming up in the label list either?

    ReplyDelete
    Replies
    1. Hi Ryan,

      Assuming you've changed the address as per stated in Extra #1, you'd be able to see your hidden posts in that one label page alone.

      If you've given your posts more than a label, and you'd like your hidden posts to be visible in all these label pages, see Extra #2

      Let me know how it goes.. Cheers.

      Delete
  88. Thanks for your useful tweaks. This one, however, has no effect on my page. I am using Design Views, Magazine Template. I noted that the end of your code in Step 2 differs from the 'ending portion' image? I would like to remove all but an introductory post on my home page and shift all other posts to labelled headers. Thanks. Bruce

    ReplyDelete
    Replies
    1. Hi Bruce,

      I had to update the text code in the steps above, thus the reason why some lines are missing from the one found in the image version.

      In any case, this tweak won't work in Dynamic View templates. It is for static templates only. Dynamic View templates hardly have anything that can be tweaked (except cosmetic ones).. It works in 'mid-air', as we call it, and it fetches elements from your blog's data and 'fills-in' in its dynamic template.. The 'Edit HTML' button that you see for Dynamic View template is nothing but a joke.. I still don't understand why Blogger would make it available for users, as though it is something useful for people to play with. I'm sorry to disappoint you.

      Delete
  89. Hey.. great article from a great guy. I've followed your step and it's working. Thanks for the hard working and sharing the knowledge. BUT the problem arise when i add second label. I've followed your reply to Rodrigo and/or mbahtokek. Posts appear in both second label and homepage. Help please.

    ReplyDelete
    Replies
    1. Hi Tamizi,

      If you want to use multiple hide labels to hide your posts from your main page, you need to change Line 10 from the code above. See 'Extra 2' for more details. Let me know how it goes :)

      Delete
    2. Hi Yoga,

      I replaced line 10 to the line in Extra2. Once clicked save template this error message appear.

      Error parsing XML, line 1663, column 3: The element type "div" must be terminated by the matching end-tag "".

      Waiting for your further action. :)

      Delete
    3. Hi Tamizi,

      That doesn't seem right. Looks like a Div tag has been distorted in your template, whereas Line 10 involves an 'if' conditional tag only. Mind giving it another try - or perhaps start all over with your backup code?

      Delete
  90. hi nice post. i have tried with above steps.it worked with hiding the post of certain labels.

    Thaks.

    ReplyDelete
    Replies
    1. Hi bang jefri,

      Thanks for the feedback. Appreciate it! :)

      Delete
  91. Awesome Trick man i have used this trick as to increase my pages , 20 pages allowed in blogger? ,i can make several thousand by this thanks buddy!!

    regard,
    H4ck3r Cracks

    ReplyDelete
  92. it sounds good, but I need a little bit of help:
    I want to change line 46 to my label "Inspirationen" but it doesn´t works.
    Look:

    var dhar = '';
    if(dhar == "hide" || dhar == "label2"){

    Where is the mistake?
    I´m sorry.
    see you
    Felix

    ReplyDelete
    Replies
    1. Hi Felix,

      Before you customize the label name, have you tried and see if the tweak works with its default settings? BTW, this tweak will not work with Dynamic View templates..

      Get back to me.. Cheers :)

      Delete
  93. I use Dynamic View Templates - that´s the mistake.
    Is there a way to get a specific label like http://xxx.blogspot.de/search/label/aaa
    as the first page instead of the main blog?
    see ya

    ReplyDelete
    Replies
    1. Yeah, there's a way to set a custom page in your blog as the default landing page. Go to Dashboard - Settings - Search Preferences - Custom Redirects - Edit and the rest is self-explanatory :)

      Delete
  94. Hi Yoga,

    This code is just phenomenal. I'm just wondering if there's a way to hide these hidden posts from the blogger favicon search widget as well?

    Thanks in advance!

    ReplyDelete
    Replies
    1. Hi TTW,

      Since the search widget uses our feed to crawl into our posts, unfortunately, it won't be possible to apply another filter there..

      Sorry bout that :/
      Cheers :)

      Delete
  95. Yeap.. The tweak only hides your post from your homepage, not search engines.. Cheers..

    ReplyDelete
  96. Thanks a lot for sharing this!

    Initially my solution was to loop through the labels of each blog entry and search for the specific label using Blogger's widget tags, but I only wanted it for the homepage and couldn't wrap my brain around it. I'm writing event posts in my blog and I'm setting the post date to the date of the actual event, however doing this creates "sticky" posts. Using your code allows me to hide events from my homepage and display them on the Events page along with subpages for filtering (such as showing events in 2013 at the following url: http://inspiredbynikki.blogspot.com/search/label/events+2013).

    ReplyDelete
    Replies
    1. Ah, finally, someone that speaks technical! Nice blog by the way. Keep up the good work :)

      Cheers and God bless..

      Delete
    2. Yup! Comp sci major ;-)

      Thanks for the compliment!

      Cheers and God bless to you too!

      Delete
  97. This worked great, but I'm just wondering how to hide this label from all pages.

    The posts with the hidden label don't appear on my homepage but when I click on 'Older Posts' at the bottom and progress to the second page, all the hidden posts are on the page. How do I fix this to hide the label from ALL pages?

    ReplyDelete
    Replies
    1. What you're describing isn't suppose to happen, unless if Line 10 of the code is misconfigured. What do you have in Line 10 of your code?

      Delete
    2. Thanks so much, it was line 10.

      I'm also wondering, when accessed on smartphones none of my posts are hidden. Is there a tweak for this?

      Thanks again,
      Rebecca Flint.

      Delete
    3. You might have mobile view set on - which means your blog will use a different template (the mobile one) when viewed on a mobile device. The tweak above is applied for the desktop template only.. You could disable mobile view if you dont want your mobile template appearing in mobile devices..

      Delete
  98. Why You Write Long Code.

    You Can Do This By Adding Just Two Line Code :)

    And For Label You Want :D

    ReplyDelete
  99. i want more than one posts to disappear from homepage if for first post label is hide and i can change it if i want where can i put my other labels in the code so when i implement them on other posts them disappear on home page also???????


    http://ptetech.blogspot.com/

    ReplyDelete
    Replies
    1. I have not tested it and I can't tell if it will work, but you could try changing the word 'label2' in Line 46 in the code above to a different label..

      Cheers.

      Delete
  100. How if I want to hide more than one labels? Example I want to hide posts under "Illustrations" and "Recipes" from my main page because I have two page tabs for those labels? Thanks btw, very useful :)

    ReplyDelete
    Replies
    1. I'd strongly recommend you to introduce a third label that would do the hiding job, while keeping the 'Illustrations' and 'Recipes' labels intact. That would be more efficient, while still maintaining the integrity of your original labels. That said, I did future-proof the tweak by including the function to use more than one hide-labels, but it is still in beta stage as I never get the chance to fully test it.

      Feel free to give it a try. In Line 46, change 'hide' and 'label2' to that of your two labels. But DO backup your template before you attempt this tweak, and it'd be a good idea to do a test-run on a dummy blog first.

      Delete
  101. Great job admin! but unfortunately it transformed the shap of my template to a greater extent..so i cancelled it again and once again searching for a solution...do have any reason suggestion for that???

    ReplyDelete
    Replies
    1. Hi Arif,

      The code was developed using Blogger's templates, and it is safe to assume that it will not work efficiently on third party templates. You could contact the author of your blog's template to see if there's a similar tweak that you could try on. Cheers :)

      Delete
  102. Thank you! Thank you! Thank you! This is the second tutorial of yours that I've used and they've both worked seamlessly and were very easy to do. Much appreciated! If it's okay with you, I plan on posting a link to your page and these tutorials on my blog to share your page with others.

    ReplyDelete
    Replies
    1. Hi Little Birdier,

      Thanks :) Appreciate the remarks. And yeah, go ahead :D

      Cheers and God bless..

      Delete
  103. Great. very helpful.. Now i can get rid of the post i dont want to show in my home page. thanks a lot bro. thumbs up

    ReplyDelete
  104. how...? This code is amazing and it works! How did you even come up with this idea?

    ReplyDelete
  105. Hi Yoga,

    This is an excellent tutorial. I have made the changes although the end line in the replacement copy does not match "The code in place (ending portion)" image. I changed one of my post labels to Hide (with no other label names) and it still shows on my home page. The post is entitled Black Friday. When I use the label dropdown, the Hide category shows with (1), as it should. Also, the label name Hide appears in the "Blog Categories" on the left side of the blog. I read that you mentioned you would address this issue in another tutorial. Is hiding the label name from the category list something that can be done?

    My blog is www.theboutiquegiftbaskets.com and is a simple Blogger template. Would you have time to review this and let me know what I have done wrong?

    Thank you and best wishes for a happy new year!

    Ken

    ReplyDelete
    Replies
    1. Hi Ken,

      Please disregard the image as I've updated the code a couple of times. As for the label, could you try using 'hide' instead of 'Hide'? Can't remember if the query is case-sensitive, but it's worth a try. Also, use your main blog's URL to prepare the code and for testing purposes (http://theboutiquegiftbaskets.blogspot.com/), instead of your website domain. Integrating the blog into your website is another thing, let's get the tweak to work in the main blog first (my concern being the URL test may fail). In any case, try changing the label to 'hide' first and get back to me.

      As for hiding the label from your Category list, simply edit your Labels gadget - Show - Selected Labels.

      Cheers :)

      Delete
    2. Hi Yoga,

      Absolutely brilliant! The label "hide" does need to be in lower case and works perfectly now! Editing the Labels gadget hid the "hide" label, as you directed.

      Many, many thanks for your very quick response and for all of the kind assistance you have offered to so many, including me!

      Best of luck in your studies!

      Ken

      Delete
    3. Excellent! You might be able to 'Hide' if you change line 46 to reflect the capitalized version of the word. Give it a try. Cheers! :)

      Delete
  106. Hey Yoga, thanks for the wonderful post. Add me as another user of your code :) .. Although you said in your comments it doesnt work for dynamic templates but I would really love to see if the google team does something like this for dynamic templates too..

    ReplyDelete
    Replies
    1. Hi Hareesh,

      I'd say it's just a matter of time before someone comes up with a way. Let's keep our fingers crossed!

      Cheers :)

      Delete
  107. Hey Yoga, I was literally upside down trying to find out the ways to implement my blog according to my ideas..i had even posted my question to you in help forums..but finally i have redesigned my blog the way i wanted..all thanks to you.. :)
    have a look at it..http://backbenchtalk.blogspot.com
    thank again..

    ReplyDelete
  108. yoga u really awesome,thanks for this post...... it really helps me alot because i want to categorize my posts using labels(featured post widget).so that every post will come under their labels(featured post widget) but problem is they are appearing in homepage and labels(featured post widget) also so i have to hide them in homepage and unhide them in their labels(featured post widget).


    here in this post u have given the code which i want exactly to come out of my problem

    thanks a lot dude.

    ReplyDelete
  109. I HAD PROBLEM NOW IHAD SEEN THAT MY CAROUSEL IS NOT WORKING. I THINK TH PROBLEM IS WITH http://code.jquery.com/jquery-latest.js'/

    IF I REMOVE THAT CODE FROM LINE 163 CAROUSEL IS WORKING BUT POSTS ARE NOT HIDING

    PLEASE HELP ME SEE MY BLOG ONCE HTTP://OURTFI.COM

    ReplyDelete

Please use the 'Ask a Question' page to shoot questions that are not related to the tutorial in the post above.