Friday, September 15, 2006

Last Visit Message

Want to give your visitors a warm welcome and show them when they last visited your Blog? This is how it is done!

All experienced Blog-hackers will tell you that those Javascripts will terribly slow down the loading of your Blog.

I know that's true, but still, now and then I like one of those thingies on my Blog.

I added a Last Visit Message, that shows when you visited my blog for the last time.

It is very easy to implement.
First, add a new Page Element of the HTML-type to your Layout. Add the
following javascript code to the contents of this Page Element, and save.
Your message is ready!

If you want this message to appear only at your Blog's main page, you have to edit the widget in your template.
Look for the widget, and add the <b:if>-statements as shown in red:

<b:widget id='HTML1' locked='false' title='Last Visit' type='HTML'>
<b:includable id='main'> 

<!-- only display if on homepage -->
<b:if cond='data:blog.url == data:blog.homepageUrl'>

<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/> 

</b:if>
</b:includable>
</b:widget>