Use a calendar to sort by tags YYYY/MM/DD

Apr 21, 2011 at 3:22 PM

All of my posts to my blog are tagged with a date (example: YYYY/MM/DD) I'm using 2.0 to create the tags for each post.

I would like to have a calendar displayed on the site where when you click on a date it navigates to the url: plus the date that was selected. 

So this would give you something like:

Then all posts related to that date will be displayed.

Anyone have any ideas how to get started? What kind of things I should search for?  Any links?

Apr 22, 2011 at 12:20 PM

If you haven't yet seen it, there's a Calendar widget you can add.  It'll show a calendar, and bold the days where there are posts.  If you click on one of these bolded dates, it'll take you to a URL that looks like:


... and the post that will be displayed will be the ones that were created just on that day.

If you prefer to use your existing tags, I think you could relatively easily modify the Calendar widget to produce a different URL.  The code for this Calendar widget is in PostCalendar.cs under App_Data\Controls.  It looks like the URL is created on line 127.  I think that line could be simply changed to:

HRef = string.Format("{0}?tag=/{1}/{2}/{3}", Utils.RelativeWebRoot, day.Date.Year, day.Date.ToString("MM"), day.Date.ToString("dd"))

Untested.  The main thing here is that without further modification, it is going to bold dates based on whether there are any posts on that day.  It's not looking to see if a Tag actually exists.  Assuming you always have a tag for each day a post exists, then I believe this will work.

Jun 9, 2011 at 9:51 AM

Hello, could you kindly let us have the calendar widget download link?

Thanks in advance

Jun 9, 2011 at 12:45 PM

Sorry, just solved