Archive control for Sitefinity blogs

Archive control for Sitefinity blogs

July 13, 2007 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

This post will explain how to implement archive functionality in Sitefinity blogs, similar to the one you can see on this blog. The idea is pretty simple. We want to list all the months in a year and show many posts have been published in that month, regardless of how embarrassing sometimes that can be (take June or April on this blog for example). When user clicks on a link we want to display the list of posts published in that month.

Not in a reading mood? Download the controls right away!

Page structure

To archive this you'll need three different pages in your blog. Take a look at the graphic below to see what I mean.


Pages / controls structure of archives functionality
As you can see there are three different pages that we have :
  • All posts page - this is a page where you will put two (at minimum) controls. The standard PostList control and Archive control (it is a user control which you can download at the bottom of this post)
  • Single post page - this page has also two controls. The standard SinglePost control and again Archive control
  • Archive posts page - this is the page that will display only posts published in a particular month of a year. Instead of using a standard PostList control you will use here ArchivePostList control, which is a user control that wraps up standard PostList control and alters it's data source to show appropriate posts.

Controls

As you may have already noticed, I have mentioned two controls that do not come with standard Sitefinity installation. These are the two user controls I have built to archive this functionality.

Archive control

Archive control is the control you will have pretty much on every page. It displays month and year together with the number of posts published in that month. There are two important properties of this control :
  • SelectedBlogs - determines for which blog(s) will archive be created. This allows you to have different archive controls for each blog and maybe one control that creates archive for all blogs on your site.
  • ArchivePageUrl - this property sets the url of a page where you have put ArchivePostList control. This property is very similar to the ExternalSinglePostPage property of standard PostList control. Basically, you are telling control where to go when the month link is clicked.

ArchivePostList control

This control is a user control which only purpose is to wrap the standard PostList control and modify it's data source to show only posts published in a particular month. There is only one property in this control, though you can modify the control to expose more of the PostList control's properties.
  • ExternalSinglePostPage - this property determines the page which contains SinglePost control or in other words, where should you go when you click on the post inside of the list.

Summary

All in all it's pretty simple functionality. You will notice in the ArchivePostList control how to take advantage of the newly introduced property CustomDataSource. The two mentioned controls are commented and you can download them from here.
progress-logo

The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments
Comments are disabled in preview mode.
Topics
 
 
Latest Stories in
Your Inbox
Subscribe
More From Progress
New_Mobile_Dev_Ebook_Progress_Website_Thumbail
The New Mobile Development Landscape
Download Whitepaper
 
IDC Spotlight Sitefinity Thumbnail
Choosing the Right Digital Experience Platform to Improve Business Outcomes
Download Whitepaper
 
TheFastestWayToBuildMobileAppsArtboard-2
The Fastest Way to Build Mobile Apps With Cloud Data
Watch Webinar