Pages

Monday, September 9, 2013

40

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.
See the hack
for this dynamic
views icon: