Date Headings in Action Streams

I'm playing with Action Streams in MT so I can add my activity elsewhere here. It's rather daunting, unless you just want to use the default settings, so I'm going to try to post tips as I go.

Say you have a feed that is infrequently updated that you want to display on you site using Action Streams. For me, it was my feed. I use to share music that I find interesting, but I don't do so regularly. Some days I might blip a bunch of songs, then I might go days before the next blip.

The bundled Action Streams feed widget sorts the items by the day of the week. So, you get the subhead of 'Today' and the items posted today, then you'd get 'Thursday' (since today is Friday) and the items from yesterday, then 'Wednesday' and so on until the max number of items is reached.

Well, if you set the number of items too high or if you don't generate new items that often, you can get multiple instances of 'Today'. The reason is, the widget code simply checks to see what day it is today and then looks for any items that have the same day and changes the label to today. So, anything that happened on 'Friday', even if it's 28 weeks ago, gets labeled 'Today'.

It's a little odd to see 'Today' then 'Monday' then 'Thursday' then 'Today' again.

Fortunately, the fix is easy. You just change the date format to look for 'Month date' instead. That's an attribute of the <mt:date> tag. In the Action Streams Widget, it's <mt:date format="%A">, change that to <mt:date format="%B %d">. You'll also need to change the <mt:StreamActionDate format="%A"> to <mt:StreamActionDate format="%B %d">.

That's it. Now, today's items will still say 'Today', but older items will be labeled by their actual date, 'May 3'. If you want the date formatted differently, you can use the various attributes of the <mt:date> tag to generate whatever output you want.

Related Entries

Monthly Archives