Since I wrote the post titled Create Static Pages in Blogger – Part 2 I have been asked on numerous occasions about hiding the static page from the homepage or main page. For blogs without many posts, the static pages may appear on the homepage when someone visits the blog.
It isn’t hard to hide static pages on your blog’s homepage, but it does take a bit of coding, much like it was to create the static page. In this post, I’ll explain what you need to change to prevent the static pages from appearing on the homepage of your Blogger blog.
Hiding the Static Pages

As you may know, static pages are regular post pages, but the code within the template causes them to look different when displayed. Since they are regular posts, they could show up on your blog’s homepage.
To prevent them from appearing, you can use the following steps:
- First, if you haven’t already done so, create a static page by following the steps outlined in Create Static Pages in Blogger – Part 2.
- Once you have created a static page, make a backup of your current template before proceeding.
- Next, open your template in the HTML editor within Blogger. We will be editing the HTML, so we will need to work in that editor.
- Click the “Expand Widget Templates” checkbox to ensure all the code is displayed.
- Using your web browser’s “Find” feature, search for the following:
<b:loop values='data:posts' var='post'>
This is where Blogger will loop through the posts that will be displayed on each page. For individual post pages, only one post will be shown, while a homepage will have many.
- Now comes the tricky part, replace the following lines of code:
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.dateHeader'>
<p class='date-header'><data:post.dateHeader/></p>
</b:if>
<b:include data='post' name='post'/>
<b:if cond='data:blog.pageType == "item"'>
<b:include data='post' name='comments'/>
</b:if>
<b:if cond='data:post.includeAd'>
<data:adEnd/>
<data:adCode/>
<data:adStart/>
</b:if>
<b:if cond='data:post.trackLatency'>
<data:post.latencyJs/>
</b:if>
</b:loop>with these lines of code:
<b:loop values='data:posts' var='post'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<b:if cond='data:post.dateHeader != "June 23, 2006"'>
<b:if cond='data:post.dateHeader'>
<p class='date-header'><data:post.dateHeader/></p>
</b:if>
<b:include data='post' name='post'/>
</b:if>
<b:else/>
<b:if cond='data:post.dateHeader != "June 23, 2006"'>
<b:if cond='data:post.dateHeader'>
<p class='date-header'>
<data:post.dateHeader/>
</p>
</b:if>
</b:if>
<b:include data='post' name='post'/>
<b:if cond='data:post.dateHeader != "June 23, 2006"'>
<b:include data='post' name='comments'/>
</b:if>
</b:if>
<b:if cond='data:post.includeAd'>
<data:adEnd/>
<data:adCode/>
<data:adStart/>
</b:if>
<b:if cond='data:post.trackLatency'>
<data:post.latencyJs/>
</b:if>
</b:loop>Note:
Remember to replace the date and format shown above with your own or this code won’t work properly.
- Click the “Save Template” button at the bottom to update your template. If there are no errors, view your homepage to ensure your static pages are hidden.
How the Code Works
For those interested, here is what the actual code is doing:
Blogger begins to loop through the posts using this line:
Next, we check to see if current page (data:blog.url) is the homepage (data:blog.homepageUrl) with this line:
If it is, we then check the post date to see if it doesn’t match our static page date. Also, if you created more than one static page, we must include a date check, since other pages after the first page for a date don’t have a date header associated with them.
<b:if cond='data:post.dateHeader != "June 23, 2006"'>
If the date doesn’t match, then we display the post on the page:
<data:post.dateHeader/>
</p>
<b:include data='post' name='post'/>
If it is a static page, then we don’t display it at all. The remainder of the code displays the post or static page for all other pages on the blog.
That is all that is needed to hide static pages from the homepage in a Blogger blog.
Related Posts
Create Static Pages in Blogger – Part 2
How to Hide the Posted By Line in Blogger
Remove Navigation Links For Static Pages in Blogger









Thank you for your excellent instructions and explanation! I made all the changes and worked through the error messages – however, I am unable to find the issue with the message below. Body has been closed with html . Please assist.
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The element type “body” must be terminated by the matching end-tag “”.
This issue usually occurs when you have an open tag but haven’t closed it properly. Check all your tags to ensure they are all closed. Also, you may also want to ensure that your quotes are proper and then they aren’t odd looking.
The best way of looking for the problem tags is to find an XML editor online and install it on your local machine. The editor within Blogger is not easy to use when it comes to finding errors in your template.
Thank you!! Thank you!! The suggestion to download an XML Editor was the best yet. I now have one final error that the Editor does not seem to find …and I still cannot save the template. See error in next paragraph:
The processing instruction target matching “[xX][mM][lL]” is not allowed.
I’m unable to locate anything like this in my template. Any suggestions as to where I might look or how to resolve?
Again, thanks for the tip on the editor.
Please disregard my previous message. I’ve searched google and found what I need to clear up my latest issue.
Thanks again!
I used the browser finder to find the loop code and it shows that I had the same exact code three different times and the lines that follow don’t look like the codes that needs to be replaced… what should I do?
dear paul,
ive done this trick several times with different templates. it worked like magic! THANKS TO YOUR MAGIC TOUCH!
but this is the first time it has gone wrong.
it is perfect immediately after i save and view the blog…but when i refreshed , the ‘phantom’ page that im suppose to hide starts to appear . i think, there’s something wrong with the looping because there were two of in the template. please help!
Hi..i’m actually having what I think to be the opposite issue…my static pages show up on my home page and i want them to, but when you visit them, you only get the title link and not the whole page…is there something else i need to do? any help will be greatly appreciated.