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:
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'> </div></div> </b:if> <b:if cond='data:post.isDateStart'> <div class="date-outer"> </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'> <div class="date-posts"> </b:if> <div class='post-outer'> <b:include data='post' name='post'/> <b:include cond='data:blog.pageType in {"static_page","item"}' 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'> </div></div> </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':
The code in place (ending portion)
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 == "index"'> <script type='text/javascript'>var ssyby='<data:post.dateHeader/>';</script> <div class='ssyby-date-outer2'> <b:if cond='data:post.labels'> <b:if cond='data:blog.url != "http://yoboy-12.blogspot.com/search/label/hide"'> <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 == "static_page"'> <b:include data='post' name='comment_picker'/> </b:if> <b:if cond='data:blog.pageType == "item"'> <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 = '<data:label.name/>'; if(dhar == "hide" || dhar == "label2"){ document.write("<div class='hide-climb'/>"); 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 == "static_page"'> <b:include data='post' name='comment_picker'/> </b:if> <b:if cond='data:blog.pageType == "item"'> <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='<data:post.dateHeader/>';</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 == "static_page"'> <b:include data='post' name='comment_picker'/> </b:if> <b:if cond='data:blog.pageType == "item"'> <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='<data:post.dateHeader/>';</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 == "static_page"'> <b:include data='post' name='comment_picker'/> </b:if> <b:if cond='data:blog.pageType == "item"'> <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> $('.hide-climb').closest('.ssyby-date-outer2').css('display', 'none'); </script>The code in place (starting portion)
The code in place (ending portion)
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!
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:
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/hideYou 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:
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.
2) If you notice a weird margin issue in Internet Explorer alone, try the following fix instead.
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.
Good work, thanks :)
ReplyDelete@Chankey: You're welcome. Cheers.
ReplyDeleteAWESOME, dude! I will definitely be using this one. :)
ReplyDelete@GJE: Glad to hear that. Cheers.
ReplyDeleteOkay, now how do we hide the "HIDE" tag from the labels list? :)
ReplyDelete@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.
ReplyDeleteWow. This is totally not working for me. I'm kind of stuck at Step 1! Is that possible?
ReplyDelete@GJE: What seems to be the problem?
ReplyDeleteOh my God! Genius!!! Worked!!! Thank you very much!
ReplyDelete@Harada10: Appreciate the feedback. Thankss..
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteOh, 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.
ReplyDeleteI choose to show 5 posts per page and also using "readmore summary hack with image thumbnail".
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@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.
ReplyDeleteI 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@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.
ReplyDeleteHere 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@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@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@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.
ReplyDeleteThis 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@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.
ReplyDeletehi 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
ReplyDeletehi 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@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.
ReplyDeleteNice article.
ReplyDeleteIt 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.
nice nice nice! :) works fine!
ReplyDelete@//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.
ReplyDelete@Anon: Glad it works. Cheers.
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@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.
ReplyDeletegreat tutorial man. it worked just great n tnx 4 putin everythin in an eary way
ReplyDelete@Justion: Don't I just love to see a comment like yours early in the morning :) Thanks mate.. Cheers.
ReplyDeletethx .. i can hide my post now .. tat's all wad i need .. really thx u ^^
ReplyDelete@April: Glad you like it. Cheers :)
ReplyDeleteThanks for your nice post.
ReplyDelete@Amazing World: You're most welcome :)
ReplyDeleteI have a different html template....how to rearrange it...please help....below is my template
ReplyDeletehttp://hotfile.com/dl/137632645/bbf0d58/template-5125324495784758422.xml.html
@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 :)
ReplyDeletei will be you code soon, thanks again yoboy..
ReplyDelete@firdaus: Do let me know how it goes :)
ReplyDeletehi yoboy, can you develope a code that can display all post in some page and hide on homepage.
ReplyDeletei mean like this (example)
www.southernspeakers.net/p/blog.html
all post display on that page..
thank you
@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 :)
ReplyDeleteHi YoboY, is there a way to do this in Dynamic Views? Seeing as we can't edit HTML yet, it seems impossible!
ReplyDeleteNot at the moment there isn't. Let's have our fingers crossed :)
Deletehey, i used the tweak and now before hiding each and evry article is repeated 5 times. what to do?
ReplyDeleteI 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.
DeleteAwesome hack ,Hats off
ReplyDeleteIt doesn't work for me! Some help http://zombieddon.com Check out the source and tell me what can I do! Thanks a lot!
ReplyDeleteYou'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.
DeleteHmm...I looked through all the comments...I don't understand what I'm doing wrong.
ReplyDeleteSame 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?
It's hard to tell what might have gone wrong. Mind if I take a look at your blog?
DeleteIt's trinityvalleybeekeepers.blogspot
DeleteStill 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!
Hi Vanessa,
DeleteIt 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.
Hi Vanessa,
DeleteI'll have a look at your template. You can delete the file from rapidshare.
OK, thanks for trying.
ReplyDeleteI messed around with it for a while too without any luck. :(
ReplyDeleteFixeed it :) I've updated the tutorial above. It should work fine now. Many thanks to you for spotting this bug!
DeleteThank you so much--it works now!!
DeleteNo, thank YOU for spotting the bug and not giving up :) Cheers~
DeleteThank 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.
ReplyDeleteAh, 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..
DeleteMy posts that have the hide label don't show up on the hide label page. Any thoughts, I changed line 10.
ReplyDeleteHi Enick,
DeleteAllow 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.
Hi Yogaratnam,
ReplyDeleteI appreciate you looking at this thank you. Below is link.
http://pastebin.com/SAUg9jaA
Thank you
Hi Enick,
ReplyDeleteChange Line 10, from this:
<b:if cond='data:blog.url != "http://nowitmakescents.blogspot.com/search/label/hide/search/label/hide"'>
to this:
<b:if cond='data:blog.url != "http://nowitmakescents.blogspot.com/search/label/hide"'>
Let me know how it goes..
@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).
ReplyDeleteOsgoode.
Hi Osgoode,
DeleteUnfortunately, 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.
You are the fucking man. Thanks so much for your hard work!
ReplyDeleteCheers! :)
DeleteHi Yoboy,
ReplyDeleteI 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.
Hi Anon,
DeleteWhat address are you entering in Line 10?
Yoboy,
ReplyDeleteThis 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.
Hi Anon,
DeleteI couldnt see the address in your previous comment. Got left out somehow?
Sorry,
ReplyDeleteHere is the address in line 10.
Thanks,
Allison
Oopsiee. Missing again. Perhaps you wanna convert your line into comment-friendly version before pasting it here?
Deletedaughtersofdivinecharacter.blogspot.com/p/faith-writer-blogs.html/search/label/hide"'>
ReplyDeleteIt should be: <b:if cond='data:blog.url != "daughtersofdivinecharacter.blogspot.com/p/faith-writer-blogs.html/search/label/hide"'>
ReplyDeleteIf 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.
Yes this is what I have in my blog with http:directly in front of daughtersofdivinecharacter.
ReplyDeleteCan you check this out for me?
I'd be happy to. But your blog is set as private.
DeleteThe blog page is still in the making but I changed all the settings to public view.
ReplyDeleteThanks
Hi Allison,
DeleteThis is what you should be using for your Line 10:
<b:if cond='data:blog.url != "http://daughtersofdivinecharacter.blogspot.com/search/label/hide"'>
All the best!
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.
ReplyDeleteThanks so much for your time and patience!
Yoboy,
ReplyDeleteOne more thing? How do I get the top tabs to link to the posts I click on them?
Thanks
Hi Allison,
DeleteGlad 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?
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!
ReplyDeleteThat's great! It took almost 8months to come up with a working bug-free solution for this tweak. Glad you find it helpful :)
DeleteHappy blogging!
Hi
DeleteIs it possible to Hide one or more Links in a blogpost and unhide it if someone post a comment ?
Hi JediMind,
DeleteThe 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.
You are amazing!!!
ReplyDeleteThanks :)
DeleteBummer but thx for the replay.
ReplyDeletecheers
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.
ReplyDeleteawaiting respond,
Marky
its not working.. i've tried and re do it. But nothing happen.
ReplyDeleteHi Mark,
DeleteI 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.
Hi, Yogaratnam.
ReplyDeleteThanks 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.
Hi Info,
DeleteCan 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.
Here it is:
Deleteb: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.
This comment has been removed by the author.
DeleteThis comment has been removed by the author.
DeleteI found out what it was...
DeleteSince 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
Hi Rodrigo,
DeleteI 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! :)
Thanks,
ReplyDeleteI 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
Hi Rodrigo,
DeleteWhat do you mean by sideblogs? Whatever it is, repeating the code might not be a good idea.
Hi Yoga,
ReplyDeleteThe 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.
Hi Rodrigo,
DeleteI 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!
I found out about it. I'm awesome too!
DeleteThe 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
That's great! Happy blogging :)
DeleteHi bozzz,
ReplyDeletethanks 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,
Hi mbahtokek,
Delete1) 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!
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..
ReplyDeleteHi BK,
DeleteTo 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.
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/
ReplyDeletewith 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:)
Hi Charlotte,
DeleteThere 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 :)
Thanks:)
ReplyDeleteThank 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!
ReplyDeleteGlad things worked out smoothly for you :)
DeleteThanks for updating with tweak with changes in threaded comments :) :) You are awesome
ReplyDeleteAnd thanks to you for noticing the bug :) Appreciate it.
DeleteThat's great! Only one little thing: in order to change the label name line 41 is now 46.
ReplyDeleteThank you for your skills.
Oopsie.. Thanks for noticing Niccolo :)
DeleteHello 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.
ReplyDeletei 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
Hi Anon,
DeleteWhat is the address that you're using to replace Line 10?
This comment has been removed by the author.
ReplyDeleteHi JM,
DeleteThat'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.
This comment has been removed by the author.
ReplyDeleteHi JM,
DeleteThat 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..
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteDon'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.
DeleteLabel 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'>
when i do that u say to replace line 12 with that then error and cant save!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteAhhh, 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!
Deleteworking fine thank you! :)
ReplyDeleteExcellent! :)
DeleteI need ur help once again,
ReplyDeletei 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!
Hi Anon,
DeleteYou sent me a tutorial page. Where can I see this navigation page that you're referring to?
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?
ReplyDeleteThe 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?
Deletelovegrowsdesign.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.
DeleteMost 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..
DeleteIf 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 :)
yay!! little tweaks here and there and it works! thanks so much! i've seriously been trying to figure this out for ages!
DeleteSo glad to hear that! Don't forget to keep a backup copy of your up-to-date working template :)
DeleteCheers and God bless..
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?
ReplyDeleteHi Ryan,
DeleteI'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..
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?
ReplyDeleteHi Ryan,
DeleteI'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..
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?
ReplyDeleteHi Ryan,
DeleteAssuming 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.
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
ReplyDeleteHi Bruce,
DeleteI 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.
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.
ReplyDeleteHi Tamizi,
DeleteIf 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 :)
Hi Yoga,
DeleteI 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. :)
Hi Tamizi,
DeleteThat 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?
Awesome Work And Thank You :D
ReplyDeleteThanks for the feedback :D
Deletenice post!
ReplyDeleteThanks Ken! :)
Deletehi nice post. i have tried with above steps.it worked with hiding the post of certain labels.
ReplyDeleteThaks.
Hi bang jefri,
DeleteThanks for the feedback. Appreciate it! :)
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!!
ReplyDeleteregard,
H4ck3r Cracks
You're most welcome mate :)
DeleteCheers!
it sounds good, but I need a little bit of help:
ReplyDeleteI 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
Hi Felix,
DeleteBefore 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 :)
I use Dynamic View Templates - that´s the mistake.
ReplyDeleteIs 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
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 :)
DeleteHi Yoga,
ReplyDeleteThis 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!
Hi TTW,
DeleteSince 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 :)
Yeap.. The tweak only hides your post from your homepage, not search engines.. Cheers..
ReplyDeleteThanks a lot for sharing this!
ReplyDeleteInitially 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).
Ah, finally, someone that speaks technical! Nice blog by the way. Keep up the good work :)
DeleteCheers and God bless..
Yup! Comp sci major ;-)
DeleteThanks for the compliment!
Cheers and God bless to you too!
This worked great, but I'm just wondering how to hide this label from all pages.
ReplyDeleteThe 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?
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?
DeleteThanks so much, it was line 10.
DeleteI'm also wondering, when accessed on smartphones none of my posts are hidden. Is there a tweak for this?
Thanks again,
Rebecca Flint.
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..
DeleteWhy You Write Long Code.
ReplyDeleteYou Can Do This By Adding Just Two Line Code :)
And For Label You Want :D
No you can't.
Deletei 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???????
ReplyDeletehttp://ptetech.blogspot.com/
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..
DeleteCheers.
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 :)
ReplyDeleteI'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.
DeleteFeel 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.
awesome work man!!!!!!
ReplyDeleteGreat 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???
ReplyDeleteHi Arif,
DeleteThe 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 :)
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.
ReplyDeleteHi Little Birdier,
DeleteThanks :) Appreciate the remarks. And yeah, go ahead :D
Cheers and God bless..
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
ReplyDeleteThanks alot :)
Deletehow...? This code is amazing and it works! How did you even come up with this idea?
ReplyDeleteLOL.. took me literally weeks! :D
DeleteHi Yoga,
ReplyDeleteThis 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
Hi Ken,
DeletePlease 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 :)
Hi Yoga,
DeleteAbsolutely 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
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! :)
DeleteHey 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..
ReplyDeleteHi Hareesh,
DeleteI'd say it's just a matter of time before someone comes up with a way. Let's keep our fingers crossed!
Cheers :)
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.. :)
ReplyDeletehave a look at it..http://backbenchtalk.blogspot.com
thank again..
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).
ReplyDeletehere in this post u have given the code which i want exactly to come out of my problem
thanks a lot dude.
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'/
ReplyDeleteIF 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