Pages

Monday, September 9, 2013

42

Hiding posts from Blogpost home page

I started doing this hack after I got a question if it is possible to hide blog posts from home page or not. And it is, with quite easy template modifications.

You must have a list of urls to the articles you want to hide from home page. Use the "blogspot.com" domain in the urls, not the local ones (like "blogspot.fi" in Finland).

I will hide one post, url is http://yabtb.blogspot.com/2013/09/test-post-hidden-from-home-page.html

Go to design, Template, Edit HTML. Select Jump to widget, "Blog1". Search for line:

<div class="date-outer">

Replace that line with either this code:

<div class="date-outer"
    <b:if cond='data:blog.pageType == &quot;index&quot;'>
    <b:if cond='data:blog.searchQuery == &quot;&quot;'>
    <b:if cond='data:blog.searchLabel == &quot;&quot;'>
            <b:if cond='data:post.url == &quot;http://yabtb.blogspot.com/2013/09/test-post-hidden-from-home-page.html&quot;'> style=&#39;display:none;&#39;</b:if>
            <b:if cond='data:post.url == &quot;ANOTHER ARTICLE URL&quot;'> style=&#39;display:none;&#39;</b:if>
          </b:if>
          </b:if>
          </b:if>
       &gt;

or this code:

&lt;div class=&quot;date-outer&quot;
    <b:if cond='data:blog.url == data:blog.homepageUrl'>
            <b:if cond='data:post.url == &quot;http://yabtb.blogspot.com/2013/09/test-post-hidden-from-home-page.html&quot;'> style=&#39;display:none;&#39;</b:if>
            <b:if cond='data:post.url == &quot;ANOTHER ARTICLE URL&quot;'> style=&#39;display:none;&#39;</b:if>
          </b:if>
       &gt;

First code hides articles from the home page (yourblog.blogspot.com) and the older posts' pages, when you click "Older posts" on the home page. This is probably the option you want.

Second code hides articles just from the home page (yourblog.blogspot.com).

If you have three articles you want to hide, make three lines starting with <b:if cond='data:post.url == &quot; (lines 5-6 in the code snippets). Edit your urls carefully to the lines.

Save template. Test.

Hack is installed on this blog, and it is hiding this post http://yabtb.blogspot.com/2013/09/test-post-hidden-from-home-page.html from the home page of this blog.

If you have articles published on same date and you wish to hide one of them, you should install my Show date on all Blogger posts within same date, or edit the date of the article to be hidden.
[Hide comments] - [Show comments]
Click on a single comment to hide/show its text

42 comments:

Taufik Nurrohman said... [reply]

That way just hide the blog post via CSS and will still load the HTML markup + still add extra HTTP request. This is better:

<b:if cond='data:blog.url != data:blog.homepageUrl'>
  <b:section class='main' id='main' showaddelement='yes'>
    <b:widget id='Blog1' locked='true' title='Posting Blog' type='Blog'/>
  </b:section>
</b:if>

MS-potilas said... [reply]

@Taufik Nurrohman
Thanks. Your example is different than mine, yours hides all posts from the home page. That way you can have a different home page rather than having posts displayed there. This can be useful for some blogs. My hack hides individual post(s) from home page (and consequent pages). And yes, it does load the post's html markup and just hides the post div via CSS, that is the simplest way to do it without modifying the post loop a lot. And this way it is compatible with my "Show date on all Blogger posts within same date" hack.

Taufik Nurrohman said... [reply]

@MS-potilas Okay.

Then, if the case is to hide some specific blog posts via CSS, then I've another idea. The idea is to use the post ID like this:

<div class='post' expr:id='&quot;post-&quot; + data:post.id'>

When the IDs already applied to the posts, then you no longer need to touch the <b:widget> element and can focus on the source code (to get the post ID) and the <style> tag, using the post ID to hide blog post via ID selector:

<style>
<b:if cond='data:blog.url == ... >
#post-1234567 {display:none}
</b:if>
<b:if cond='data:blog.searchLabel == ... >
#post-8903456 {display:none}
</b:if>
</style>


:)

LeeAnn@Encouragement Is Contagious said... [reply]

I wonder if you can help me with making my comment post link larger? I saw your 2011 post on this, but I think blogger has changed since then and I tried to follow your instructions, but when got to the part that said click on Expand Widget, I could not find it. Do you have a updated post by chance on how to enlarge the post comment link?
Thank you so much for your help.

Lee Ann

MS-potilas said... [reply]

@LeeAnn@Encouragement Is Contagious
Hi, I updated the article, here. Instead of choosing "Expand widget templates" choose "Jump to widget", "Blog1".

Syed Shah said... [reply]

wow sir... I'm first time here and your posts are superb... believe me... I have a small question that is it possible to break post in different pages in blogger same like wp. for examaple: abc.com/2013/10/abc.html/2
Thank you!

MS-potilas said... [reply]

@syed shah
Hi, there are (at least) two options:

1. You can write the text in one post and several (hidden) pages and link them together.
2. You can divide your text in div elements, then make a "page menu", which toggles the visible div (page).

There's discussion about this in Google Product Forums that may help you further.

Unknown said... [reply]

You are a God. That was so simple. Thank you so much, you Rockstar you ;)

Unknown said... [reply]

Hi

I've tried your idea but it hide everything ?

Any help

Thanks.

MS-potilas said... [reply]

@Aero Houcine Hi, sorry for the late reply, I was away for a week. Well, if everything was hidden, then there must have been some kind of error in the installation. Try to reinstall and follow the instructions carefully. :)

helloiamprince said... [reply]

Hi! This is a great tutorial. I'm wondering, though, if the original/hidden content/blog post will still appear if you use its specific URL. I just want to hide several blog posts from the home page and archive but my readers will be directed to those blog posts through a link in the navigation. Is this possible? I'll be waiting for your response. Thanks a lot.

MS-potilas said... [reply]

@P. Follosco
Hi, yes, the hidden post(s) can be opened and viewed using the post's url.

helloiamprince said... [reply]

@MS-potilas Great! Thanks for this awesome tutorial! Gotta try this! :D

helloiamprince said... [reply]

@MS-potilas And will the hiddenn posts be visible to search engines?

MS-potilas said... [reply]

@P. Follosco
Yes they will, search engines will find them for example through older/newer post links. If you want to hide the contents from search engines, check this hack.

Unknown said... [reply]
This comment has been removed by the author.
MS-potilas said... [reply]

@Katarina Kovcin
Hi,
you can hide posts also from archive pages (*archive.html) by adding some code to this hack. Here is an example of a modified code, lines 9-11 are added to handle one post hiding from archive pages.

This method won't hide posts from the archive widget that usually is on the sidebar.

Unknown said... [reply]

@MS-potilas

All of my posts are hidden from homepage but i want to get that using labels but when i clicks labels its still not showing up...Whats the matter. I dont need posts in homepage only. I should retrieve it from mt labels.. :/ What to do..?

MS-potilas said... [reply]

@Thunder Junior
Hi,
you should use different hack for that, this hack is for hiding individual posts, not all. There should be hacks for doing what you want, quick googling revealed for example this: Hide blog posts from blogger home page.

Nugie said... [reply]

Hi, thanks for sharing. Please help me how can I hide posts for a specific label effectively. I can make it by using CSS (display:none;) but the page navigation will count the hidden posts still. That should not be happened. Really appreciate for your help. Thanks!

MS-potilas said... [reply]

@Nugie Souksma
Hi,
I tried to come up with a solution, but unfortunately did not succeed. The problem is, that in the templat's post loop you don't have access to labels, that happens later in the labels loop but that's too late then.

So I think only solution is to hide using CSS, and if you want to get rid of the hidden posts, you can use JQuery after page load to remove those posts from DOM. But at load they all exist.

Nugie said... [reply]

@MS-potilas

Thanks for your quick response. I agree with you the only solution for the time being is to hide using CSS and change the date to the back otherwise some areas in my grid view will be empty due to these hidden posts.

I don't think if I really want to get rid of the hidden posts as I need them in my list view :). I combine both type of views in my blog. One for products and the other one for blogging or else.

Just to make it clear please allow me to show what I meant at tc4x.blogspot.com - I restyle the theme for my purpose. The page navigation is not accurately counting the posts either in main page or blog area as I rely on the label names to make it different.

Thanks very much indeed for your efforts to come up with a solution. It is really appreciated!

Angel said... [reply]

hi, is there a way to hide the blogger url so that when someone clicks on something on my blog they only see the domain name, & not blogger?

MS-potilas said... [reply]

@Angel
Hi,
if you have your own domain (web address), you could make there a simple page with a frameset or an iframe, that contains your blog. Then the address bar will always show your only domain, not blogger domain/urls. This is called url masking or domain masking. This could be ok for small blogs/sites (just a few pages), but I would not use it for full blogs.

If you have your own domain, you usually can use that domain name instead of the default somesite.blogspot.com. I'd prefer this option, although it won't hide the rest of the url (/year/month/postname.html). Google for "domain blogger" to get more info.

Consoler said... [reply]

@MS-potilas

What template most fits this code? because it seems it won't work on mine

MS-potilas said... [reply]

@Game Console
Hi,
this works at least on the Simple template provided by Blogger.

Unknown said... [reply]

thanks it worked but is there any way of hide post with same label once

MS-potilas said... [reply]

@Tosin Ariyo
Hi.
I think that is not possible using the technique in this hack. You could try this: http://www.technogeekzone.com/2015/02/how-to-hide-specific-label-posts-from-blogger-blog-homepage.html

Unknown said... [reply]

Hi MS-potilas.
Great blog.
I need your help.
I've tried everything but nothing seems to work with my blog, the "Hide posts under specific label" doesn't work and your "hack" didn't work either, when I replace the codes and insert the url for the post I want to hide it hides all the posts from the home page, not just the one I want. I think I use a dynamic template that might be the issue.
I really hope you can help me.
Thanks a lot!

MS-potilas said... [reply]

@Jon Whitehead
Hi, I checked that rarefilmm.com is not using dynamic template, but the template seems to be uncompatible with template hacks that work on templates based on Simple template. My hacks are based on that. For example the date-outer div on your blog does not exist for every post, only at the first post, so single posts can not be hid by hiding that div, what this hack does. I'm afraid I cannot help you further, the author of the blog template might be able to help more.

MS-potilas said... [reply]

@Jon Whitehead
Hiding posts using CSS could work, like Taufik Nurrohman shows in the comment http://yabtb.blogspot.fi/2013/09/hiding-posts-from-blogpost-home-page.html?showComment=1378989926126#c5701316537991016562. The instructions are unfortunately not complete, so programming skills are needed to apply that.

Unknown said... [reply]

@MS-potilas:
Thanks for your help, I'll try to contact Taufik. You're awesome!
Best,
Jon.

Barry Smyth said... [reply]

@Taufik Nurrohman

But where do you put this code in the template?

Jewelleish said... [reply]

please help me

how to hide specific level post from blogger homepage?

MS-potilas said... [reply]

@Jewelleish
Hi, what do you mean by specific level post? What defines the level of a post?

Hoangdacviet said... [reply]

So data of Post http://yabtb.blogspot.com/2013/09/test-post-hidden-from-home-page.html still load. Is it simply hidden?

Thank you very very much!
Sign VnTim CEO Kome Cafe Vietnamese Coffee https://www.kome.cafe

Kate said... [reply]

HIV/AIDS CURE via the HELP of Dr Murphy
Hello everybody, thanks to Dr. Murphy spell caster I am from Africa i don't just Know the reason why some people is finding it difficult to believe that there is a cure for HIV, my brother have been suffering from HIV since last three years but today i am happy that he is cure from it with the herbal medicine of Dr Murphy the great healer,i was browsing the INTERNET searching for help when i came across a testimony shared by someone on how Dr Murphy cure his herpes i was so much in need of getting his treatment but after all Dr Murphy brought a smile to my son face with his herbal medicine. i am so much happy today that we have someone like this great healer out there, please sir keep your good worked cause there are people out there who is in need of your healing medicine you can call him or whats-App his number +2347057214618
DOCTOR MURPHY CAN AS WELL CURE THE FOLLOWING DISEASE:-
1. HIV/AIDS
2. HERPES
3. CANCER
4. ALS
5. Hepatitis
6 Diabetes
7 LOVE SPELL
8 Money SPELL
9 IF YOU NEED YOUR EX LOVER BACK TO LOVE YOU AGAIN. Contact Dr Murphy whatsapp +2347057214618 or email
Drmurphycure@gmail.com

Post a Comment

Related Posts Plugin for WordPress, Blogger...
See the hack
for this dynamic
views icon: