I recently wrote a post titled How to Create Static Pages in Blogger where I discussed one method of using posts to mimic static pages. One question that was asked involved removing the static pages from the post archives in Blogger. From what I have seen, you can’t prevent a post from being added to the archives, which would make all static posts appear.
Using my programming background, I decided to find a way to prevent the static pages from appearing in the archives. When experimenting with different methods, I finally came up with a method that works, as well as allows commenting on the static pages. This post explains how to create this type of static page.
Benefits of the New Method
In my first post about static pages in Blogger, I removed the ability to comment on a static page. This was the flag to Blogger that indicated the page was to be static and that the date shouldn’t be displayed. Now I know some may want to enable comments on certain static pages, so this method wasn’t going to work for them.
I went back to the drawing board and came up with another solution to the problem. The new solution has two benefits:
- The new static pages allow comments (unless you disable this ability for the page).
- The static pages will be removed from the Archives widget.
If this sounds like something you are interested in accomplishing, then read on. I do have to mention that there will be some editing of your blog’s template to make these static pages work properly, but I will try to walk you through the edits step-by-step.
Gathering Some Information
Before we begin, we will first need to grab some setting values from your blog. To find these values, use the following steps:
- Log in to your Blogger account and then click the “Settings” link beside your blog.
- Click the “Formatting” link near the top.
- Beside the “Date Header Format” option you will notice the format used to display the dates in your post. Write down the date displayed so you know how the dates are displayed in each post. For example, the date displayed for my blog is “June 16, 2008″, which means that I will write down this date.
- After you know the format of the date, let’s check the format of your archives. Click the “Layout” tab at the top of the screen.
- Look for the “Archives” element in your layout and then click its “Edit” link.
- Next to “Style” you will see three option buttons, with one of them selected. Write down the name of the selected option.
- Beside the “Date Format” option, you will see the format of the archives dates. Write down the date you see displayed. For those that have selected the “Hierarchy” option record the value in the “Year” option.
- Click the “Cancel” button to close the window.
For example, mine is displayed as “January 2006″ or “2006″ for the Hierarchy option, so I will write that date down.
Now, this part doesn’t require any setting lookup, but I just want you to think of a date that occurs in the year “previous” to your first post.
As an example, I have chosen “June 23, 2006″ as my date as this is exactly one year “before” I started Technically Easy. The steps I will outline below, will use this date. When following the steps below, you should use your own date instead of mine. From this point forward, all static posts should use this date.
Now that you have these two date formats and a date from the past, let’s get started on creating some static pages.
Creating a Static Page
So now we have the post date format, the archives date format, and a date that occured in the past before your first post. Let’s create a static page.
- Under the “Layout” tab, click the “Edit HTML” link.
- Let’s backup the template first. Click the “Download Full Template” link to save your current template.
- Once the template is backed up, check the “Expand Widget Templates” checkbox to display the code for all elements on your blog.
- Search for the following:
<data:post.dateHeader/>
This is the code that displays the date for each post.
- Change that line of code so it looks like:
<b:if cond='data:post.dateHeader != "June 23, 2006"'>
<data:post.dateHeader/>
</b:if>Keep in mind that you should insert the date you chose above instead of my date. Also make sure that the date is in the correct format, which was the first format you wrote down.
The above line tells Blogger to only display the date in the post if the date of the post is not June 23, 2006.
- Once you have inserted the above code, search for “BlogArchive”. This should bring you to your archives widget.
- Search for:
<b:includable id='flat' var='data'>
- Replace the entire includable section with the following:
<b:includable id='flat' var='data'>
<ul>
<b:loop values='data:data' var='i'>
<b:if cond='data:i.name != "June 2006"'>
<li class='archivedate'>
<a expr:href='data:i.url'><data:i.name/></a> (<data:i.post-count/>)
</li>
</b:if>
</b:loop>
</ul>
</b:includable> - Search for:
<b:includable id='menu' var='data'>
- Replace the entire includable section with the following:
<b:includable id='menu' var='data'>
<select expr:id='data:widget.instanceId + "_ArchiveMenu"'>
<option value=''><data:title/></option>
<b:loop values='data:data' var='i'>
<b:if cond='data:i.name != "June 2006"'>
<option expr:value='data:i.url'><data:i.name/> (<data:i.post-count/>)</option>
</b:if>
</b:loop>
</select>
</b:includable> - Search for:
<b:includable id='interval' var='intervalData'>
- Replace the entire includable section with the following:
<b:includable id='interval' var='intervalData'>
<b:loop values='data:intervalData' var='i'>
<b:if cond='data:i.name != "2006"'>
<ul>
<li expr:class='"archivedate " + data:i.expclass'>
<b:include data='i' name='toggle'/>
<a class='post-count-link' expr:href='data:i.url'><data:i.name/></a>
<span class='post-count' dir='ltr'>(<data:i.post-count/>)</span>
<b:if cond='data:i.data'>
<b:include data='i.data' name='interval'/>
</b:if>
<b:if cond='data:i.posts'>
<b:include data='i.posts' name='posts'/>
</b:if>
</li>
</ul>
</b:if>
</b:loop>
</b:includable> - Once you have changed your archives section, click the “Save Template” button at the bottom to save your template.
- If you receive an error, check the changes you made to ensure you closed all of your tags.
- Now if you have previously created static pages, edit those posts and change the post date to your new date you have chosen.
Changing this code is a little more complex. The reason for this is that you can display the archives a few different ways. This is where the archives option that you wrote down comes into play.
If you chose the “Flat List” archives, use the following steps:
Once again you will use your month and year chosen in place of mine. You will need to also ensure that the date is formatted the same as the your archives format you wrote down earlier. Since the date I chose was “June 23, 2006″, and my date format was “January 2006″, I would write my date as “June 2006″.
The above lines of code tell Blogger to only display the archive link if the archive date does not equal “June 2006″. Since I started my blog after June 2006, the only posts published in that date are my static pages.
If you chose the “Dropdown Menu” archives, use the following steps:
Once again you will use your month and year chosen in place of mine. You will need to also ensure that the date is formatted the same as the your archives format you wrote down earlier. Since the date I chose was “June 23, 2006″, and my date format was “January 2006″, I would write my date as “June 2006″.
The above lines of code tell Blogger to only display the archive link if the archive date does not equal “June 2006″. Since I started my blog after June 2006, the only posts published in that date are my static pages.
If you chose the “Hierarchy” archives, use the following steps:
You will use your year chosen in place of mine.
The above lines of code tell Blogger to only display the archive link if the archive date year does not equal “2006″. Since I started my blog after 2006, the only posts published in that year are my static pages.
Now whenever you publish a static post using the date you specified you can enable comments, and prevent the post from appearing in the archives widget on your blog.
This post was complex to write, so if you spot an error in my steps, please let me know and I will correct the error to avoid any problems in the future.
Adding HTML Code in Comments:
If you reply in the comments with some HTML code it won’t appear in the comments. To make the HTML code appear, ensure you add the HTML code as outlined in How to Display HTML Code in Blog Comments.
Summary
I had previously written a post that explained how to use posts as static pages in Blogger. The method provided in that post prevented comments from being displayed on that page as well as the page being displayed in the archives.
The method outline above allows comments in the post, as well as removes the post from the archives so the post acts more like a static page than an actual post.
Update:
If you are having trouble with the above code, send me your template using the contact form (link above), along with the error and I’ll have a look. Editing templates in Blogger can be difficult since the built-in editor doesn’t help in correcting syntax.
Related Posts
How to Create Static Pages in Blogger
How to Create a Development Blog in Blogger
Blog Designing Tops for New Bloggers
Remove Navigation Links For Static Pages in Blogger










i’ve sent it to you.
[...] If you have already created static pages in the past, then do the same for this post. If you haven’t created static pages, then follow the instructions to create a static page in Blogger. [...]
I followed your instructions but still the post is still showing in my page, also in Archives so I revert it to my recent XML as you informed to download it for recovery. I deactive the comments in my template, does this affect the format of the static page you created? or should I activate comments first?
I believe I correctly followed the steps provided, but my “static page” is still showing when I go to the main page of my blog. Would you be able to help me fix this? Thanks so much! (It’s probably me…I’m new to blogging)
To hide the static pages from your main page, you will need to also follow the steps listed on Hiding Static Pages from Main Page in Blogger.
Hi there, your instructions hepled me a lot.. I have now created static pages in 5 different bloggers. I have only 1 tiny problem…. I still see the ‘author’ and ‘newer posts’ displayed. This is the last thing I need to hide, do you have any ideas? I can’t find any useful information online, all they suggest is to delete the whole link, but that would also delete it from my other posts!
Thanks, Dennie
For the “author” data, you can surround the <data:post.author/> tag in an if statement the same way you did for the <data:post.dateheader/> tag.
For the “newer posts” link, you can find out how to do this from this post: Remove Navigation Links For Static Pages in Blogger.
Dear Paul,
Thanks for your help, so far I have managed to do everything I want.. and I’m just doing HTML since 2 days, your website helped me a lot ^___^
Removing the author is a bit more of a problem. The author is shown in a blue box, so when I apply the code on it isn’t working.
The full section that contains ‘author’ looks like this:
Do you have any idea if within this code I can hide the appearance, or is it going to be even more difficult?
Thanks and keep up the good work.
Dennie
[...] He is also active in managing and editing Blogger template code. His most popular Blogger post provides instructions on creating a static page in Blogger. [...]
Thanks for the help. I managed to do it. But I want to remove the post from home page too. How can it be done?
It can be done. I outline how to do it in this post: Hiding Static Pages from Main Page in Blogger.
Thank you so much! With a little bit of fiddling I managed to follow it all. My blog is definitely starting to take shape. Good tutorial,
Thank you so much for this tutorial! It was immensely helpful and it’s made my blog just how I want it!