Saturday, October 01, 2011

Static Home Page in Blogger - Yes, You Can!

Although off subject for this site, this is an entry covering how to create a static home page in Blogger.

A search on Google will throw up pages and pages of 2 types of responses to the question of "can I have a static home page on my Blogger site?" They are:
1. "No."
2. "Sure, just post-date an article as 2030 or something and it will always be shown as the first entry!!!!"

1. is wrong, 2. is just stupid.

It's a piece of cake.

Here's how you do it:

Find this code in your HTML template:

<body>


Directly after that, paste this code:


<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!--Start Home Page-->


Ha, did it! Take that Google idiots!


<!--End Home Page-->
<b:else/>





That's it.

Now all you need to do is replace the "Google idiots" text with something of your own.

CSS etc. declared elsewhere in the template will still apply.

You may still want to direct users to your most recent blog entries on one page, like your current setup. To do that, link to this URL:

http://YourBlogURL/search?max-results=10

Obviously, change the YourBlogURL to... your blog URL. The number after "max-result" is how many entries will be displayed when clicked.

Beware that your new "Home Page" will now appear as your default template in Blogger, so changing the layout of your regular blog page (i.e. the page displayed when a post or page is being viewed) cannot be edited in the way you are used to. The best way to now do this is (if you don't have any coding skills):

1. Back up your template.
2. Create a new temporary blog site and import your template into that.
3. On the temporary site, delete the Home Page code completely.
4. You can now edit the default template to how you want it.
5. Re-add the code (copy and paste from the "official" site's template).
6. Check it works.
7. Back up the new template and import it to your "official" blog.
8. Done.

3 comments:

  1. Top post. I look forward to reading more. Cheers

    Scuba Lesson

    ReplyDelete
  2. i dont see the "body" word on my home page.. do you mean "tbody"? there are 2 of those listed in my HTML format so its still not working - ah! can you help?

    ReplyDelete
  3. No, it's body and it's definitely there. View the HTML of your template. Search for body.

    ReplyDelete