How to Hide Posts from Blogger Homepage

The point of blogging is to make your blog posts visible to your target audience as well as to search engines. However, there are times when you need to hide certain blog posts from homepage. For instance, one post may contain outdated information, so you don't want it to be seen by your audience but you also want to keep it on your site for records purposes. Or perhaps you want a certain post to still be seen on your blog, but you don't want it to show in the home page.

hide blogger post from homepage
Either way, you have to find ways to hide certain blog posts. Fortunately, if you're using Blogger, you can easily do so by taking a few simple steps. You can use this guide to get started.

hide post from home page

Backdate Blogger Posts

Let's discuss this technique first since it's simple and doesn't require you to deal with any lines of code. Basically, the only thing you need to do is to change the publishing date of the post you want to hide; specifically, you need to backdate it to the oldest possible date. Doing this is effective if your Blogger site is configured to show the latest posts first (as most blogs are); once a post is backdated, it will no longer be shown in the home page.

How do you do this? If you're publishing a new post and want to hide it, look for the "Schedule" option on the right side of the post editor and click on "Set date and time". Choose a previous date on the calendar, click 'Done' and Save the post, then go back to your blog's home page to check if the post has disappeared.

backdate post, schedule blogger post

The same process applies if you want to hide an older post; the only difference is that you need to click on the post's title in the dashboard to open it in the editor. Backdate the post using the steps above and save it, then open your blog to verify that the post is indeed hidden from view.

Please note that this process will only hide your posts from the homepage. People will still be able to see them if they'd take the time to go through your blog posts from the previous years. This is also the case for those who'd come across your hidden blog post through search engines.

Hide Blog Posts in Blogger Using Code

Another thing you can do to hide a blog post is to edit its code. This is a bit complicated since one small mistake can affect the post structure and make it unreadable. This, in turn, can affect your readers' experience as they browse through your site and even have a negative effect on your search engine optimization techniques. With this in mind, it's important to be careful when dealing with code.

Method 1: Hide Blogger Post Using the Post's label

There are two techniques to choose from, and one of them involves the label of the blog post you want to hide. If you're ready to go ahead with this method, you'll first need to make a backup of your template. Having a backup is important since it ensures you'll have a copy to fall back on in case something goes wrong.

Once you've backed up the template, go to "Templates", click on "Edit HTML" and then click anywhere inside the code area -> press CTRL + F keys and search for this line:
<b:include data='post' name='post'/>
Once you've found it, replace it with this code:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<b:loop values='data:post.labels' var='label'>
        <b:if cond='data:label.isLast == "true"'>
            <b:if cond='data:label.name != "add label here"'>
                <b:include data='post' name='post' />
            </b:if>
        </b:if>
    </b:loop>
<b:else/>
    <b:include data='post' name='post' />
</b:if>
Note: replace the text "add label here" with the label (case sensitive) of the blog post that you want to hide in Blogger homepage. Keep in mind that above code won't work if you have multiple labels on that post, so please make sure the post has only 1 label.

Important: every post that you want to show on the homepage should have at least one label otherwise they will not be visible because the b:loop statement won't be executed for them.

Finally, Save the changes by pressing the 'Save template' button on the upper left side of the editor, then view your blog to check if the blog post has been hidden.

Method 2: Hide Blogger Post Using the Post's ID Number

Aside from the method above, you can use another technique that involves the post ID number of the blog post you'd like to hide. To know the ID number, you must go to the dashboard area, find the title of the post you want to hide, and click the "Edit" text link below it. Doing this will open the post in the Blogger editor.

Once you're in the editor, click on the address bar above and go to the end part of the URL. Here, you'll see a line of text that looks like this: postID==, followed by a long string of numbers. This is your post's ID number. The ID number usually contains 19 numbers, so it will look somehow like this: postID==1234567890123456789. Copy this ID since you'll need it for the next step.

hide blogger post using id

When you have your blog post's ID, open the Blogger dashboard, go to Template, and click "Edit HTML". Search for this line:
<div class='post hentry uncustomized-post-template' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'>
Replace it with this one:
<div class='post hentry uncustomized-post-template' expr:id='&quot;post-&quot; + data:post.id' itemprop='blogPost' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'>
Note: if you found two occurrences of it, replace both of them.

Now search for this tag:
</head>

Once you find it, paste the following code above it:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<style type='text/css'>
#post-1234567890123456789{display:none;}
</style>
</b:if>

Don't forget to replace "1234567890123456789" with the 19-digit ID number of the blog post you'd like to hide. Once you're done, make sure to save the template. You can open your blog in another tab or browser to check if the post has indeed been hidden.

That's it!

Whether you backdate your post or opt for the post ID method, you have to remember that the blog post you've hidden is still on your website. This means that it will still be indexed by search engines, show up on search engine results, and get found by people who are searching for the keywords that are present in the post. If you really want this blog post to be seen by no one, you'll need to use robots.txt (for Google) to remove it from search results. Better yet, completely delete the post from your Blogger dashboard and just keep a soft copy of it in your computer.

3 comments: