Sunday, November 27, 2011

Blogger Magic - A Static Home Page

Every week, somebody asks for such a simple blog feature.
How do I have a single blog post always displayed, for the home page?
There are many things that Blogger has yet to provide, and this is one. A blog, by definition, contains a dynamic home page, with the most current posts displayed.

Today (sorry, too late!), if you view this blog, this post will be displayed, at the very top of the home page. Tomorrow, this post will be displayed, just not at the top of the home page. In a couple weeks, this post will not be displayed on the home page, at all. That is how blogs work. If you want to display anything else, you don't have a blog.

That's the purist position, anyway. A blog is simply a web site with the latest posts displayed on home page (the main page), and hidden older posts (the archives).


(Update 2012/06/06): The recent "Search preferences" feature allows us to setup a true static home page, with none of the complications below.
The neat thing about this magic trick is that it's not difficult to make it work. I categorise this trick as a snake, after the old taunt from my mother
If it had been a snake, it would have bitten you.

It's so simple, really.
  1. Make the blog not display any posts, for home page.
  2. Add a text gadget.
  3. Tweak the text gadget to only display, when home page URL is displayed.
  4. Use the Pages gadget, and index the rest of the blog. Add links using various label searches, pages, and posts, as you like.

Make The Home Page Not Display Any Posts
If you make the main page not display any posts, you get an empty home page. Settings - "Posts and comments" contains the "Show" setting. Set "Show" to "0 posts", and the blog has an empty home page.

Add A Text Gadget
Add an HTML / Text gadget, positioned just above or below the "Blog Posts" gadget. Setup the new gadget just like the blog post, that you would want permanently displayed. If you want to use the post editor to compose the gadget, do that.

Tweak The Template
This is the one part of this project, that requires any technique. Use the Template Editor, and edit the gadget template, for the gadget that you just added, so the gadget only displays when the home page URL is being displayed.

Use The Pages Gadget, To Index The Rest Of The Blog
Once you have a static home page gadget, just add links to the rest of the blog. You can have links in the new gadget - and you can have an index in the blog header, or in the sidebar. Use your imagination here, it's your blog.

That's it. Really.

>> Top

5 comments:

pmaillet said...

I have a simpler method that I've used on all my blogs. Create the post that you want to be always on the top. Then edit the post and change the date to something like 2019.

Joemanji Rock Arts said...

Thanks for the information. JoemanjiRockArts - www.ufoinuae.blogspot.com

Marian Cates said...

I guess I'm being dense, but why would anyone want to have the same post show on the blog home page every day of the year?

Chuck said...

Marian,

There are any number of reasons for someone wanting any given post to remain on top, above any number of subsequent posts. A welcome post is the best known, and most requested - though not the only one.

http://blogging.nitecruzr.net/2006/06/putting-post-at-top-welcome-post.html

michiiella yuzon said...

thank you so much for this! I've finally done this on my blog thanks to your tutorial. Thanks a lot again.