Site revealed: ’blog calendar


I read a lot of blogs, and I do like the wee calendar one often sees to navigate around particular blog entries. I wondered about having such a thing in Domino for a bit, then put it to the back of my mind.

However, one day I was reading a blog over at Codestore. Jake said something like

… Having seen them [blog calendars] on other blogs I’ve always wanted one and now I have. Thanks, that is, to the site that I borrowed it from…

Always wanted one? Well why not do one? Jake did his in PHP, and you can see it at his PHP-based blog, but I wanted something in Domino.

So here’s how it works…

Code to generate a calendar

First of all, you need some code to generate a calendar. The attachment named libBlogCalendar.lss is yer badger. It’s a load of Lotusscript exported from a script library with the same name. Put succinctly (always best I think), this code takes a date, checks whether a calendar document for the relevant month exists or not (if it does, removes it first), then generates a new calendar document for that month.

The clever bit is that for each day that a document exists, a link to that document is generated. Now, on this site, I simply generate a link to the relevant day’s blog, but you could tweak this to whatever you required. Note: this is only geared up to deal with one link : one date. If you have multiple documents with the same date, the code will always take the first document as it appears in the look-up view. The script library routines are:

The starting point. This takes one argument which is a date value as a variant, and gets everything going. It instantiates a calendar document, and sets it up for population. The date has to include a day, month and year, and the actual calendar population is performed by…
The calendar generator routine. This takes the date, works out what the day is, when to start the various weeks of the month, and so on. A tabular format calendar is generated as pure HTML, but the day / link aspect is covered by…
This function takes the date being passed to it, and looks to see if a document for that date exists or not. In my specific case, it looks up to a view called “vwCalendarLookup” which lists all published blogs in the format dd-mm-yyyy (no leading zeroes on days or months though).
Blog form Postsave routine
This checks whether blog has been published and whether a calendar has been generated or not from it. If published, and a calendar hasn’t been generated, then the code assumes the calendar will now be out of date (i.e. doesn’t detail this blog under the relevant day), so generates a new one. Otherwise, leaves well alone.

The calendar

The calendar is now generated. So linking to it from my website’s main page is easy. In the case of this very website, I just added some computed text to the subform containing the search and calendar data (to your right), which looks something like this:

strMo := @Text(@Month(@Today));
strMonth := @If(@Length(strMo)=2; strMo; "0" + strMo);
strThisKey := strMonth + "-" + @Text(@Year(@Today));
strURL := @RightBack(Query_String; "&Blog=");
strKey := @If(strURL = "" | @IsUnavailable(Query_String); strThisKey; strURL);
strLookup := @DbLookup("Notes" : "NoCache"; ""; "vwCalPicker"; strKey; 2);
@If(@IsError(strLookup) | strLookup=""; "No calendar available
"; strLookup)

So what’s this all about then? Well, my front page works out what blog calendar it should be showing by reference to the Query_String, specifically the &Blog=… parameter. As you can see from the code above, if this parameter / value pair doesn’t exist, then it assume we’re at our entry page, and shows the current calendar. Anyway, the code extracts the relevant blog month and year, and uses this value as a key to look up that month’s calendar code in the “vwCalPicker” view. Calendar code is stored in a field called “txtCalendar” within our “frmCal” form, if you look at the script library. So it’s pretty easy to just have a view sorted by mm-yyyy which exposes this calendar code in one of its columns (in this case, the second column).


I’m not going to bore you / insult your intelligence with the other bits of code I have scattered about allowing calendar navigation and so forth — I’m sure you get the idea.

What’s key to this implementation, at least for me, is that the calendar is generated in the background. I don’t rely on user agents having to make several round-trips to the server simply to generate a dynamic calendar of document links (e.g. using multiple database look-ups). The stuff’s all prepared earlier, just like Blue Peter’s best sticky back plastic creations.



  1. Keen observers will have noticed that some time back I did a subtle update to the calendar code. I won't post the new version, as the updates are pretty basic, and more to do with formatting.

    For example, hovering over an active day reveals the title of the blog entry now.

    On another point, the code as it stands limits you to one blog entry / article / post / whatever per day — how I like to it personally — but there's no reason you should keep it that way.

    I would suggest a simple change to the URL used in the "active day" calendar code, depending on how your site is structured. Something like this, instead of a link to a specific document as currently used:
    …?OpenView&RestrictToCategory=02-02-2002Ben Poole#
  2. Greetings from the Philippines!

    I was browsing for blog calendar when I came across your site. I wonder if you can help me get script code that I can apply for my blog archives because I had difficulty with blogspot to show its archives with geocities sometimes which I FTPed from blogspot, archives sometimes found empty, especially when using explorer. Well, I use basic blogspot feature, maybe it's one of the reasons..

    But, do you think it is possible for me to create a permanent month calendar of archives? And can you help me find a code for it? I do not know what is domino, i am sure it is different from what I need :-)



Comments on this post are now closed.


I’m a software architect / developer / general IT wrangler specialising in web, mobile web and middleware using things like node.js, Java, C#, PHP, HTML5 and more.

Best described as a simpleton, but kindly. You can read more here.

File Attachment Icon