More in this section
Blogs RSS feed

ArchiveControl workaround - per popular demand

by Ivan Osmak

We’ve had archive control as a Sitefinity built in control for a brief time, however there were some performance issues with it, so we took it out - until we get time to rebuild it.

We’ve got quite a few complaints about removing that control and most of the people told us the old control worked just fine for them. So, I’ve created a new ArchiveControl for blogs and will publish it in this post, together with the source.

The basic idea

To have archive functionality on our site, we obviously need an archive control. However, we are also going to need a modified BlogPosts control that will know how to show only the posts for a particular month and year. So, for this workaround I have created two custom controls:

ArchiveListControl – this control will display the list of month/year pairs together with the number of posts published in that month.

BlogPostsArchiveSupport – custom control that inherits BlogPosts control and overrides CreateFilter function so that it can recognize and correctly implement query string passed by ArchiveListControl.

Both controls are very simple and I have commented the more important parts, so I won’t go into too much details. Depending on the version you are working with, you may need to rebuild the controls with correct references (I was working on 3.2 SP 1 version).

Anyhow, the compiled controls together with the source you can download from here.

Let me know if you have any questions.

p.s. with very little work you can extend of modify these controls to support Events archive, News archive and so on…


Leave a comment
  1. Seth May 13, 2008
    Hi Ivan, thanks for that... just a question Sitefinity 3.2 SP1 has a BlogsArchive control in the Blogs section of the toolbox doesn't it? At least it appears in my version anyway! It's just news and events that doesn't. Thanks again,
  2. Ivan May 14, 2008
    Hi Seth, ahh yes, it appears it does. Well, wasn't that a waste of post. Ok, perhaps not a complete waste. You can do the same for news, just change the providers (from "Blogs" to "News") and overwrite ContentView directly instead of BlogPosts.
  3. Seth May 15, 2008
    Hi Ivan, I have actually change the provider for BlogsArchive in Sitefinity 3.2 SP1 to "News" and it works however just a little catch it will only work with the ContentView not the older newsList control... this means you have to use the Generic ContentView control for news and just make the required modifications just thought I would let people know.
  4. Ivan May 16, 2008
    Hi Seth, you are right, it will only work with the ContentView. The NewsList and SingleNews control will become obsolete with the coming SP2 (we'll keep them there for some time though) and a new control NewsView will be added, which will be based on ContentView. Thanks for pointing this out.

    Leave a comment