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.




on September 1, 2009 at 3:14 pm
I have multiple static pages with the same date, but with the code as I have entered it, it only hides one of the static posts and displays the others. Do I need to change the code in another way?
Thanks!
on September 1, 2009 at 8:56 pm
I updated the code to move the date check. The problem is that posts after the first one for a specific date don’t have a date header, only a time stamp. I modified the code to first check to make sure the post has a date stamp, before performing the date value check.
on September 1, 2009 at 11:19 pm
Paul,
Terrific! That worked great. Thanks for your help and I really appreciate all the work you have put into this. It has been tremendously helpful and very informative.
on September 1, 2009 at 10:59 pm
Man, I super appreciate the work you’ve done sharing your solutions. I just did the way to hide it from the archive, and that worked perfectly, but I can’t get this to go. Maybe I’m not so good at this:
I’ve pasted the code in, and instead of hiding the posts matching the “Phantom Date”, it’s hiding any post made on the same day, after the first made on that day. (ie only the first post of the day will show up).
I did notice, and it’s really bugging me, that the quotes around “June 23…” in the code have been replaced by " but for the life of me couldn’t get regular quotes to stick. Maybe that’s my problem?
on September 2, 2009 at 8:23 am
Did you remember to change the date in the code to match your “Phantom date”?
The quotes in the code will automatically be converted to " by Blogger. This will have no effect on the code. I included the actual quote character above (“) since it is easier to read than including ".
on September 2, 2009 at 10:29 am
Being the sort of lazy person that uses code generous people post to their blog, and (though very rarely) posts comments complaining they can’t get it to work, I was using the same date as you.
However, my date FORMAT was including the day as well (ie Sumday, Avril 2020), changing that and it all works.
I can’t thank you enough for providing this information AND volunteering to help out. A huge help for the less gifted.
on September 2, 2009 at 10:35 am
No problem. The date format has gotten me frustrated when trying to get something to work in the past.
on September 10, 2009 at 6:54 pm
Paul,
Thanks again for your help, I was wondering if I could trouble you one last time. Is there a certain place in the code to look to ensure that the comments box will appear in the static pages? Viewers are able to leave comments on my main page under the posts, but on each static page there is no link to comment only the “Post Comments (ATOM)” link. I am wondering if I altered the code somehow when following the instructions you posted for creating static pages version 1 and 2.
Thanks!
Jared
on September 11, 2009 at 8:11 am
Depending on which static page tutorial you followed, you may have disabled the comments for your static page. In version 1 I mention disabling comments when creating the static page. In version 2, you can keep the comments enabled.
At the bottom of the post editor, click the “Post Options” link. Under “Reader Comments”, ensure the “Allow” option is selected for you static pages.
on September 11, 2009 at 12:47 pm
Thanks Paul, Unfortunately I have the Allow Comments option chosen for all three static pages. At the bottom of the pages there is the normal “Posted By” and “time”, but no link to leave comments, which is why I thought it may be something in the code where it loops through the date and time stamps. It’s odd indeed.
on September 15, 2009 at 8:12 am
If you would like me to take a look, just send me your template.
on September 15, 2009 at 1:23 pm
Hi Paul,
Thank you for posting the codes! I tried this on my test blog, and it does hide the static page, but unfortunately, it also hides other posts that have a different, more current date. I posted it as was shown above, and the backdated post for the static page is dated August 14, 2007, and the “newer” post is dated September September 14, 2009. I thought it might be the fact that they both have a date of 14 that was causing the problem, but when I changed the newer one to September 13, 2009, it still had this same problem. What do you think could be causing this problem? Thank you so much!
on September 16, 2009 at 8:47 am
Can you send me your template and I’ll have a look?
on September 16, 2009 at 8:57 pm
Hi Paul,
I finally got it to work-I realized I just placed the code with the wrong tag (there were two of them in my layout). Thanks again for sharing this with us!!
Alannah
on October 3, 2009 at 10:19 pm
Hi Paul,
Is there any way to tweak this code for those of us with customized templates that use timestamp code instead of dateHeader? I’m missing lines 2,3,4 (since I have no date headers) and 14, 15, 16 (not sure why) of the snippet we’re supposed to look for in our templates.
on October 6, 2009 at 8:37 am
You can still use the dateHeader tag in your code, even though you don’t display the date. The dateHeader is always available, but some templates may not use it to display the date.
on October 17, 2009 at 5:00 pm
Worked like a gem! Thanks so much!
on October 18, 2009 at 1:46 am
Actually, there is one hiccup – adding the new code has resulted in date headers being applied to my non-hidden posts. Any easy fix for this?
on October 19, 2009 at 8:31 am
Can you clarify “non-hidden posts”?
on October 19, 2009 at 2:14 pm
Non-hidden posts = The posts on my blog I don’t want to make hidden static pages; regular blog posts. I went into my blog post menu and unchecked the date header option in an attempt to get rid of it, but this ended up hiding every single post on the blog.
on October 19, 2009 at 2:22 pm
Did you want to remove the date header from all your posts? You can try editing the HTML for your posts and remove the tag from your template. Be sure to backup your template first.
on October 21, 2009 at 3:56 am
I couldn’t find any date header tags except for this code, but changed the dates to white so they won’t show up instead.
In the meantime, however, I’ve discovered I have the same problem as Roj above – only the first post of the day shows up, nothing afterwards. I’ve doublechecked my code for the same date error, i.e. putting the wrong date or the wrong format, but it’s all correct. Any advice?
on October 21, 2009 at 4:24 am
Clarification: the posts made on my phantom date have disappeared like promised; the problem I’m having is the additional disappearance of all posts after the first post on a non-phantom date.
on October 30, 2009 at 12:53 am
Any suggestions for solving this problem? I don’t have much expertise in HTML, so I’m at a loss. :/ I would really like to post multiple times in a day – and have all the posts show up.
on October 9, 2009 at 2:19 am
thanks a lot for sharing it with us… you are gem of a person..i am impressed and have subscribed to your site
on October 18, 2009 at 8:27 pm
that’s the first one of your hacks i can’t get working
i tried several times, but strangely enough the main change was, that the displayed date on my blog seems to loose it’s style information (switched to default).
several other phenomenons occurred, which i can’t report *dizzy*
on October 19, 2009 at 8:32 am
When you copy the code, ensure you use the same style (h2 or p) and CSS class that was in your original code. The styling of my code may not match yours.
on October 18, 2009 at 9:49 pm
i just detected my initial code is a little different from yours:
http://pastebin.com/f524700f5
is there a solution for me, anyhow?
on October 19, 2009 at 8:29 am
I made the change on the link. Make sure you backup your template before copying any new changes to your template.
on October 19, 2009 at 10:18 am
i just could try it out in a hurry (i’m @work right now
), but the only thing happend was, that on the main page only 3 postings apperad (instead of
– on the second page (“older posts”) everything’s displayed normal, but also the static page is listed there…
on October 20, 2009 at 7:50 am
back @home, i just tried again (several things – your modified code, changing the code line by line), but in both cases happens as follwos:
on the first/homepage all postings disapear, which have no own date-line (i.e. all those, that have been publishes on a same day), on the second page all posts are still existent (also those with no date-line), inkl. the static page.
if that may help…
on October 20, 2009 at 8:31 am
Did you include the following on your homepage in your template:
<b:include data='post' name='post'/>? This is what displays the posts.on October 20, 2009 at 11:40 am
yes, i did, since i just pasted your abovementioned code…
on October 20, 2009 at 2:09 pm
Can you send me your full template code and I’ll have a look?
on October 23, 2009 at 12:58 pm
when i use the XML-file you sent me (thx a lot), not only the static pages won’t disapear, but also many of the posts are displayed doubly.
LOL mysterious….
on October 23, 2009 at 1:19 pm
Interesting. When I tested the template I didn’t see double-posting. The post information is displayed at the
<b:include data='post' name='post'/>line. If this is repeated twice for any post then a post will be displayed twice.on November 3, 2009 at 9:23 pm
Thank you so much for taking the time to post these extremely helpful tips! I think you do an excellent job of explaining the process and make it easy to understand. I am having an issue with this code however. When I put the code in my blog still publishes the pages and also adds back in the post date which I removed in an earlier step. Any idea what I am doing wrong? Thanks again for your help!
on November 3, 2009 at 9:45 pm
Okay I figured out my initial problem (I forgot to put in the day of the week!) but now I have another problem. All of my new posts show the date twice in the posting. This did not happen before I added this code. Any suggestions?
on November 4, 2009 at 9:27 am
It depends on your code. You may have
post.dateheadercalled twice which will dispay the date twice, or you may have forgotten to close an if statement.on November 12, 2009 at 4:44 pm
Thank you so much for helping us that are less than technologically savvy. I’ve been trying to hide my static page using your method to no avail. The majority of text that you state that I should replace is not anywhere in my template all in one place. Just bits and pieces of the text scattered in different sections. Can you help me?
on November 28, 2009 at 10:45 am
Please check my blog …..I would like to be able to click on one of the menu tabs (Memories, Recipes, etc.) and post directly to that page.
What coding do I need? And, where do I put it?
Thanks much for your help!!
on December 7, 2009 at 11:11 am
hello paul.. i have following issues with my blog:
1) i used this hack on my blog but when I click on “Older Post” then my static pages are also shown as posts.
2)Also when I click on “Older Posts” then the posts starts appearing with comment box below each post.
3) I am not able to add page navigation in my blog.
Please have a look at my blog to see the problem, You are my only hope, please help me with these issues..
on December 7, 2009 at 12:38 pm
Can you send me your template, using the contact form in the top navbar, and I’ll fix it up for you.
on December 8, 2009 at 11:00 am
hi paul,
i have sent u my template.. thanks
on December 10, 2009 at 5:13 pm
hello paul,
you are gem of a person always ready to help others out. Heartfelt thanks for that.
thanks a lot for changing my template to my requirement.
i had an issue. i wanted to display post titles only on archive and labels page, but from 2nd page onwards it displays only titles and not textx. i want “titles+text” in all pages and “only titles” in labels and archive pages. can you show me a way around please ?? sorry for troubling you again and again.
on December 11, 2009 at 8:24 am
That may not be possible because of how Blogger labels the pages. For the labels, archive, and home pages, the page type is “index”. This means that when you specify pageType == “index” in your code, it applies to all three types of pages.
I’m not sure if there is an easy way of distinguishing one from another, but I’ll see what I can find. In the meantime, you may want to display the title in content on the pages to avoid any issues.
on December 8, 2009 at 8:04 am
Hi there – I am a new blogger trying to cobble together my blog, and hoping someone can help! I used the backdating method (and forward dating for the home page) to make static pages linked to a navigation link bar under my header.
However, I am baffled as to how to make the “journal” link I made connect to regular blog posts I upload. I made a normal blog post and noticed it exists in the edit posts list, but I don’t know how to get it to load on the ‘journal’ page.
I am probably just doing something really stupid….but can’t see it.
Please have a quick look and help if you can?
on December 8, 2009 at 11:00 am
I don’t think that is possible within Blogger’s code, probably Javascript can do it, though, but I haven’t looked at that option. The reason for that is how Blogger displays posts. When you display your homepage, Blogger allows you to loop through several posts to display on that page within the blog gadget. The number of posts depends on the settings in your blog.
When a post is displayed, only that post can be displayed by the blog gadget, which is why you can show multiple posts within a single post.
on December 8, 2009 at 6:03 pm
Hmm, so just to clarify – if you make your ‘home page’ into a static page, there really is no way to have any of the links then connect to a page that functions as a ‘normal’ blog….?
I saw somewhere, where someone was actually able to make a “posts” link in their navbar – but haven’t been able to find out how. Though I will try and find a workaround by tweaking the settings.
Also, I didn’t realize were were able to add javascript to blog template code… I’ll look into that too.
Thanks very much in any case.
on December 8, 2009 at 8:56 pm
After I left my last comment I thought about it for a moment. Technically there is a way to display your recent posts on a post page. It involves something like the following:
1. Create a post to display the a list of your recent posts, as you have already done with your “Journal” post. Don’t include any content, only the title.
2. Next add a “Feed” gadget to your template, right below the blog post gadget. For the feed URL, use your blog’s RSS feed.
3. Next edit your template’s HTML, and surround the code in the Feed gadget with something like the following:
<b:if cond='data:blog.url != "http://www.faeriesunrise.com/2009/12/journal.html"'>This will cause the code in the feed gadget to only display on your journal page. If you have some difficulties, just let me know, and I’ll create a post on how to do this.
on December 9, 2009 at 3:49 am
I’ve been working on the blog all day today – and after pondering about 4 workarounds, I actually did this:
Created a separate blog (with related title), changed the main-wrapper area so that it’s blank and can function as a template for a, gallery page, etc – without showing any sidebars (wouldnt want those pages to look like a blog).
Then, dumped the ‘home’ link in favor of making the “home” page BE the blog, and tie links together.
If I knew more about blogging I might be able to anticipate problems with this setup but for what I need for now it suffices.
The idea you posted is a good one – if I hadn’t already put so much work into it today I might have tried that!
In any case – I’m glad I came across your site, you’re very helpful to everyone and its very appreciated. I know my site has nothing to do with computers but I may post a link in one of my posts to your site as a thanks, if it’s ok.
Cheers for now, tytyty!
on December 9, 2009 at 12:06 am
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 followed by . 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 “”.
on December 9, 2009 at 12:07 am
Sorry – element type “body” has been followed by
on December 9, 2009 at 11:14 am
I left a comment before, but it didn’t get responded to.
Thank you so much for helping us that are less than technologically savvy. I’ve been trying to hide my static page using your method to no avail. The majority of text that you state that I should replace is not anywhere in my template all in one place. Just bits and pieces of the text scattered in different sections. I’m able to hide the static pages a little because they’re not on the main page, but I’m trying to hide them completely. Meaning, if someone clicks on “older posts”, they won’t see the static pages. Can you help me?
on December 9, 2009 at 12:08 pm
I haven’t played around with preventing the static pages from appear if some clicks the older posts link. I may be able to do it from a post page, but from an index page, it may not be doable.
I’ll play around with it and see what I can do.
on December 9, 2009 at 7:16 pm
Michelle – while I was searching around for info on static pages myself, I came across a post that says you can set the date forward in time (say, 10 years) in order to trick the blog and keep it from archiving.
Don’t know if that’s what you needed, but hope maybe it helps? Otherwise I’d just keep trying the google search. Good luck…
on December 10, 2009 at 9:40 am
T. Larking – thanks for trying to help. Unfortunately, that’s not what I’m looking for. What I’m looking for is that my static pages not being seen anywhere on the blog except for the specific link that leads to it. Basically, my static page is a FAQ page. Although, I have it set so it doesn’t show on the archive list, if you click on “older posts” you’ll eventually see it. If I use your suggestion, the post remains on the main page because the date is set in the future, although I can hide the datestamp.
on December 9, 2009 at 9:33 pm
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 “”.
on December 11, 2009 at 8:14 am
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.
on December 13, 2009 at 8:46 pm
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.
on December 13, 2009 at 11:05 pm
Please disregard my previous message. I’ve searched google and found what I need to clear up my latest issue.
Thanks again!
on January 9, 2010 at 1:19 am
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?
on January 30, 2010 at 9:35 am
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!
on February 9, 2010 at 7:09 pm
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.
on October 1, 2010 at 6:59 am
I guess the tutorial needs to be updated. I am not able to find the exact code to be replaced even after Expanding Widget Templates. I need it urgently. Plz help.
on October 1, 2010 at 8:09 am
It all depends on how your Blogger template is setup. The code may not match exactly, but the same tags should exist in your template. In that case you would need to make the adjustments to match your template.
on October 30, 2010 at 12:26 pm
please help me i want to hide my only single one page from being displayed in side bar that should be always hide not shown even in homepage
on October 31, 2010 at 9:40 pm
What gadget, in your side bar, is showing the page?
on December 23, 2010 at 2:21 pm
I set up satic page as you said
but when i post new posts, they comes in the main page
and i will have to post the static page again.
any solution for this?
so tat even when i post new posts, the static page remains on the main page.
on October 5, 2011 at 4:40 am
Nice! Thanks a lot for sharing this. It’s a very helpful tips!
Andrew Walker recently posted…James Bond in Jamaica