Friday, April 16, 2010

Putting A Post At The Top (A "Welcome" Post) - Part 2

Many people have asked how they can have a Welcome or Index message in their blog.

I have a Welcome message, at the top of Nitecruzr Buzz, or on this blog, for instance.

This blog uses a text gadget, positioned above the post gadget, which leaves a gadget that shows up on every page. On Nitecruzr Buzz, I used a future dated post, so my "Welcome" showed up only on the "Home" page. Neither solution was optimal.
  • A true "Welcome" message should show up only on the "Home" (first) page. A text gadget shows up on every page.
  • A future dated post shows up only on the "Home" page, but it shows up in the Archive index with a future date.


Today, I fixed my Buzz Welcome message, so it only shows up on the "Home" page, and it does not show up as a post, in an archive index.

What I now have is a Text gadget, that only displays on the "Home" page. Here's how you do that.

First, (you should have to ask?) backup the template. Then add a Text gadget to the page, and position the gadget just above the post gadget. Give it a snappy title, "Welcome To My Blog!".

Then tweak the new gadget.
  1. Identify the gadget to be tweaked.
  2. Add the Conditional Gadget CSS rule, using the Template Designer "Add CSS" wizard.

 
<b:if cond='data:blog.canonicalUrl != data:blog.homepageUrl'>
<style>
#Text1 {display: none !important;}
</style>
</b:if>


Remember to add a blank line, above or below the code block being added, if there is already code visible in "Add CSS".

Save the change. Edit the text gadget as displayed on the blog, and remove the "WelcomeMessage" title. And of course, backup the template, again. And, it's done.

Now, if you want a dynamic "Welcome" page - maybe one based on posts published to a given label, you can do that too, with just a bit more work. And there are several variations on the "if" statement, that will let you selectively display (or not display) your gadget on other specific pages.

An easy alternative solution for this need, more recently offered, would be to use a static page, and a redirected Home page.

The choices are multiple. Just consider your needs, and how easy the various alternatives may be.

Elm0D

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 comments:

Post a Comment

Navigate» Become author for this Blog

Manual Categories