Hide Specific Label Posts From Homepage In Blogger

If you are looking for a way to customise your blog to give it another look then you can start from customising your homepage. The homepage of your blog should have everything that will make your visitors love your blog. But you can not always post good stuff and you need some important stuff too in your blog that may not look good on your homepage.




Hide Specific Label Posts From Homepage In Blogger


So, to customise your homepage you need to filter your posts on your homepage. and unfortunately there is no way in blogger that you can do that directly but thanks to HTML codes that you can achieve anything in blogger.

Before that you need to get familiar with the powers of labels in blogger

FAQ- Lables

So why you need to customise your homepage?


Maybe this is not a good question but your homepage layout has more value than anything else and you should have a cool landing page of your blog so that visitors can have a nice time on your blog.

Basically you can install third party templates to make your blog look good but it can be tricky sometimes as you can't fully control everything in those templates if you don't have basic HTML knowledge.

Enough talk let's customise the home page by filtering the post though labels.

What this code do?


This code will hide specific labels posts from your homepage. Your posts will be there in your blog but it will not appear on your homepage.

Cool isn't it?

Let's get started

Steps to follow


  • Open blogger
  • Go to 'Template' and select 'Edit HTML'
  • Now search for this code


<b:include data='post' name='post'/>


  • Now replace that code with this one


<b:if cond='data:blog.url == data:blog.homepageUrl'>
    <b:loop values='data:post.labels' var='label'>
        <b:if cond='data:label.name != &quot;LABEL-NAME-HERE&quot;'>
            <b:include data='post' name='post' />
        </b:if>
    </b:loop>
    <b:else/>
    <b:include data='post' name='post' />
</b:if>


  • That's it save your template and you're done.


Don't forget to add the label name in that code. Here's how you can do that.

To add your label just replace the text in blue
<b:if cond='data:label.name != &quot;LABEL-NAME-HERE&quot;'>


Multiple Label Posts


In case, you want to hide multiple labels post use this code when you replace.


<b:if cond='data:blog.url == data:blog.homepageUrl'>
    <b:loop values='data:post.labels' var='label'>
        <b:if cond='data:label.name != &quot;FIRST LABEL&quot;'>
            <b:include data='post' name='post' />
        </b:if>
        <b:if cond='data:label.name != &quot;SECOND LABEL&quot;'>
            <b:include data='post' name='post' />
        </b:if>
    </b:loop>
    <b:else/>
    <b:include data='post' name='post' />
</b:if>


That's it pssssshhhhh!


Hey don't miss out this article:-

Show specific label posts in blogger

I like blogging as much as I like coding and designing though not more than traveling.
If I'm not here publishing stuff then you will find me researching about SEO and marketing.
Love to meet new people and try to help every person.
Find me interesting or have any issue?
Shoot a message and I'll be with you.

4 comments:

  1. not working mate :(
    www.todayssalt.com

    ReplyDelete
    Replies
    1. Hi there,

      Please see if you're not missing a step as all of my codes are working and I check them myself before posting here.

      Do leave me a message if you still can't any solution. :)

      Delete
  2. Hi. First at all thanks for your post. I'm trying to put it on my blog but when hide the post with de specific label, the homepage shows the last entry repeated and two post are missed. For example:

    Homepage: Post1 - post1 repeated
    Next page: Post 4 - post 5 - post 6 -post 7...

    The hidden posts only have one label and the others one have anothers labels wicht aren't related with the label I want to hide. Any idea? :/ Thanks

    ReplyDelete
    Replies
    1. Thanks for your comment.

      The issue might arise because of template. Are you using third party template?

      Delete

Don't forget to check 'Notify me' box to get notification of reply.