How to add a RSS feed to your site
QuickelSof CMS makes it easy to use RSS syndication to feed your content out as RSS data. To add a RSS feed to your web site, you only have to create a ASPX page and use it as the URL for your RSS feed and add a meta tag to let a web browser to autodetect your RSS. See the description of RSS on Wikipedia for more information. Create the RSS feed1. Create an empty page called rss.aspx. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="rss.aspx.cs" Inherits="rss" %>
2. In the page load event, fill a ContentItemCollection object with the last 20 content items. 3. Change the response content type to “text/html” 4. Return the RSS stream from the content item collection.
private void Page_Load(object sender, System.EventArgs e) { ContentItemCollection contentItems = CurrentContext.CurrentSite.RootFolder.GetContentItems(); contentItems.OrderBy = ContentItemOrderBy.PublicationDate; contentItems.SortOrder = RecordCollectionSortOrder.Descending; contentItems.IncludeSubFolders = true; contentItems.RecordsByPage = 20; contentItems.GetPage(1); Response.ContentType = "text/xml"; Response.Write(contentItems.GetRSS()); } Note: By default, GetRSS uses a time to live of 1440. The time to live is the number of minutes that indicates how long an RSS feed can be cached in an RSS reader. If you want to change this value, use the method GetRSS(int minutes). Autodetection of your RSS feedAdd this meta tag in the "head" section of your home page to let standard RSS reader application to auto detect your RSS feed. <html> <head> <link href="/rss.aspx" rel="alternate" type="application/rss+xml" /> </head>
<body> </body> </html>
Related articles
Why does QuickelSoft CMS use a prefix with ASPX in each URL?
How to install automatically QuickelSoft CMS
How to use the QuickelSoft CMS API from a .Net application
API Error Codes
How to generate a sitemap for search engines
How to add a search form to your site
QuickelSoft CMS 2.0.5 Documentation
|