How do you add RSS feeds to Home page?

This post has 14 Replies | 4 Followers

bass_player
Not Ranked
Posts 7
Points 140
By: bass_player
Posted: Tue, Jul 4 2006 1:33 AM
How do you add RSS feeds to Home page?
 
  • Post Points: 35 |
Keyvan Nayyeri
Top 25 Contributor
Posts 2,114
Points 27,675
MVPs
By: Keyvan Nayyeri
Posted: Tue, Jul 4 2006 3:10 AM In reply to

Can you explain more?

Do you mean that you want to add a link to RSS feeds in your website in homepage?

Or do you want to show the content of a RSS feed in homepage?

 
  • Post Points: 20 |
psmak4
Not Ranked
Posts 12
Points 150
By: psmak4
Posted: Tue, Aug 8 2006 12:39 PM In reply to
I have a question similar to this as well.  Under "Front Page News" on the home page, I'd rather have something like the top 5 latest roller articles rather than the latest blog entries.  How can this be done?
 
  • Post Points: 20 |
Kyderoy
Top 500 Contributor
Posts 89
Points 620
By: Kyderoy
Posted: Sat, Aug 12 2006 11:20 AM In reply to
No answers??????
 
  • Post Points: 5 |
Keyvan Nayyeri
Top 25 Contributor
Posts 2,114
Points 27,675
MVPs
By: Keyvan Nayyeri
Posted: Sat, Aug 12 2006 11:49 AM In reply to

If you want to show some stuff from your CS site, it's possible to put some CS controls and show them but this is limited to some special controls not every control.

If you want to show content from other sites (especially from RSS feeds), you need to know .NET and put an XML control and show them there.

Actually I answered what I could understand from your posts. 

 
  • Post Points: 20 |
Kyderoy
Top 500 Contributor
Posts 89
Points 620
By: Kyderoy
Posted: Mon, Aug 14 2006 3:01 PM In reply to
I was hoping that there was a way to add content of selected RSS feeds on the hompage. 

 

 
  • Post Points: 20 |
Logik!
Top 50 Contributor
Posts 338
Points 4,060
By: Logik!
Posted: Fri, Aug 18 2006 9:37 AM In reply to

You can control which feeds from which blogs are aggregated to the frontpage.

For instance, I have my own blog, and then I have an aggregated blog that a number of external feeds go to.  I only allow one of these external feeds to show up on my frontpage using the following configuration option for the mirror:

Aggregate in site blog roll

No extra coding required.

Logik!
Talking Out Loud with ASB
 
Keyvan Nayyeri
Top 25 Contributor
Posts 2,114
Points 27,675
MVPs
By: Keyvan Nayyeri
Posted: Fri, Aug 18 2006 3:13 PM In reply to

Logik,

You're absolutely right about it but what these gentlemen want is another thing.  They don't want to only show the content of a specific blog in homepage blog posts.

They want to show their favorite RSS feeds from any site as control in sidebar or any other thing to homepage.

Just to finish my answer I refer you to XSLT concept and XML control in ASP.NET.  XML control simply can get the address of your RSS feed then use an XSL Transform to show its content in any desire view.  So you need yo have a little (really little) background in XSLT.

This approach was what I did to show some syndications like Atom or Opml as you can see in 2.1.  Without the XSL file I've written, they're just a simple text.  You don't need to do a hard coding to reach to your aims.  There are tons of sites which provided many XSL files for RSS/Atom feeds and you can get and modify them for your needs.

Hope this helps.

 
  • Post Points: 35 |
greenspan
Top 500 Contributor
Posts 95
Points 1,340
By: greenspan
Posted: Fri, Aug 18 2006 10:20 PM In reply to

This maybe a long shot but I tried doing this and it worked for me.

You first copy the RSS address and go to a site that converts RSS feeds into Javascript. The resulting Javascript code can be pasted on the HTML editor in your homepage. You just have to fix the formatting if you want.

 

 
  • Post Points: 5 |
Logik!
Top 50 Contributor
Posts 338
Points 4,060
By: Logik!
Posted: Sun, Aug 20 2006 6:46 AM In reply to

Ah...    Thanks, Keyvan Smile

You read that much better than I...       Thanks for the follow-up.

Logik!
Talking Out Loud with ASB
 
  • Post Points: 20 |
DoRnbush
Not Ranked
Posts 25
Points 350
By: DoRnbush
Posted: Mon, Oct 23 2006 12:59 PM In reply to

If you want to display an RSS feed on the home page, here are the steps that I took.

1. Add attribute named "siteRssUrl" in "~/communityserver.config" (Line 79)
   <Core
       defaultLanguage="en-US"
       ....
       siteRssUrl=http://www.yoursite.com/rss.xml
   >

2. Modify "CSConfiguration.cs" file in "~/Configuration" of CommunityServerComponents project:
    - add private member variable (Line 61):
          private string siteRssUrl = String.Empty;

    - add new attribute from attributeCollection (Line 155):
          att = attributeCollection["siteRssUrl"];
          if (att != null)
               siteRssUrl = att.Value;

     - add new public property (Line 434):
          public string SiteRssUrl { get { return siteRssUrl; } }

3. Modify "~/Languages/en-US/ControlPanelResources.xml" and add the following new resource nodes (Line 164):
     <resource name="CP_SiteRSS_Announcements">Current Site Features</resource>
     <resource name="CP_SiteRSS_Announcements_More">&lt;a href=http://www.yoursite.com/"&gt; Read more at ... &amp;raquo;&lt;/a&gt;</resource>
     <resource name="CP_SiteRSS_NoAnnouncements">No feature stories are available.</resource>

4. Create new class libray file named "SiteRssFeed.cs" in "~/ControlPanel/Components" with the following code:
     using System;
     using CommunityServer.Reader.Components;
     using CommunityServer.Components;
     using CommunityServer.Configuration;
     using Rss;
     using System.Text.RegularExpressions;
     using System.Net;

     namespace CommunityServer.ControlPanel.Components
     {
          public class SiteRssFeed
          {
               static Regex stripHtml = new Regex("<[^>]*?>", RegexOptions.IgnoreCase | RegexOptions.Singleline);

               private SiteRssFeed()
               {
               }

               public static RssItemCollection GetAnnouncements()
               {
                    RssItemCollection items;

                    items = (RssItemCollection)CSCache.Get("CP-SiteRss");
                    if (items != null)
                         return items;

                    items = new RssItemCollection();
                    if (Globals.IsNullorEmpty(CSConfiguration.GetConfig().SiteRssUrl))
                         return items;

                    Feed feed = new Feed();
                    feed.Url = CSConfiguration.GetConfig().SiteRssUrl;
                    feed.Title = "Current Site Features";

                    RssFeed rssFeed = null;
                    try
                    {
                         HttpWebRequest request = feed.CreateRequest();
                         request.Timeout = 10000; // timeout in ten seconds
                         rssFeed = RssFeed.Read(request);
                    }
                    catch (Exception)
                    {
                         return items;
                    }

                    if (rssFeed != null && rssFeed.Channels != null && rssFeed.Channels.Count >= 1)
                    {
                         RssItem newItem;
                         foreach (RssItem item in rssFeed.Channels[0].Items)
                         {
                              newItem = new RssItem();
                              newItem.Link = item.Link;
                              newItem.Title = stripHtml.Replace(item.Title, "");
                              newItem.Description = stripHtml.Replace(item.Description, "");
                              if (newItem.Description.Length > 250)
                                   newItem.Description = newItem.Description.Substring(0, 250) + "...";

                              items.Add(newItem);

                              if (items.Count == 5)
                                   break;
                         }
                    }

                    CSCache.Insert("CP-SiteRss", items, new System.Web.Caching.CacheDependency(null, new string[] { CommunityServer.Configuration.CSConfiguration.CacheKey }), 60 * 60 * 24);

                    return items;
               }
          }
     }

5. Modify "~/Default.aspx" file as follows:
     - Register the control
          <%@ Register TagPrefix="CP" Namespace="CommunityServer.ControlPanel.Controls" Assembly="CommunityServer.Web" %>
    
     - Add following two lines of code to Page_Load function (Line 16):
          this.Announcements.DataSource = CommunityServer.ControlPanel.Components.SiteRssFeed.GetAnnouncements();
          this.Announcements.DataBind();

     - Add the following block of HTML below Featured Item content (Line 57):
          <div class="CommonSidebarArea">
               <h4 class="CommonSidebarHeader"><CP:ResourceControl runat="server" ResourceName="CP_SiteRSS_Announcements" ID="Resourcecontrol15"/></h4>
               <div class="CommonSidebarContent">
                    <CS:RepeaterPlusNone runat="server" id="Announcements">
                    <ItemTemplate>
                         <div style="margin-bottom: 8px; margin-top: 8px;">
                              <a href="<%# DataBinder.Eval(Container.DataItem, "Link")%>"><%#DataBinder.Eval(Container.DataItem, "Title")%></a>          
                              <div><%#DataBinder.Eval(Container.DataItem, "Description")%></div>
                         </div>
                    </ItemTemplate>
                    <NoneTemplate>
                         <div style="margin-bottom: 8px; margin-top: 8px;">
                              <CP:ResourceControl runat="server" ResourceName="CP_SiteRSS_NoAnnouncements" />
                         </div>
                    </NoneTemplate>
                    </CS:RepeaterPlusNone>
                    <CP:ResourceControl runat="server" ResourceName="CP_SiteRSS_Announcements_More" ID="Resourcecontrol16"/>
               </div>
          </div>

 
crpietschmann
Not Ranked
Posts 7
Points 95
By: crpietschmann
Posted: Tue, Dec 12 2006 10:08 AM In reply to
Thanks alot, this is just what I was looking for.
 
  • Post Points: 20 |
vulupe2
Not Ranked
Posts 2
Points 40
By: vulupe2
Posted: Fri, May 4 2007 10:32 PM In reply to

Hello,

 Have you succeded in this task? I am not a programmer but I would really like to have this possibility.

Is there any other (no coding required) way to have RSS feeds displayed on the home page?

Thanks in advance for the help.

 Marian VULPE

 
  • Post Points: 20 |
shakes
Top 50 Contributor
Posts 311
Points 4,720
By: shakes
Posted: Mon, Jun 18 2007 10:04 PM In reply to

The easiest way would probably be as mentioned before to use a rss to java converter (possibly not as search engine friendly?). I just did it and it will probably take longer to write this than it took to implement the rss into my site...open up themes/default/common/home.aspx and paste the code below in there somewhere this will give you an editable content part just make sure you change the parts in bold, i put mine below the welcome content part.

 

<CSControl:ContentPart ID="ContentPart1" ContentName="yourcontentpartname" runat="server" ContentCssClass="CommonContentPartBorderOff" ContentHoverCssClass="CommonContentPartBorderOn">

            <DefaultContentTemplate>

                <h2 class="CommonTitle">Your Title</h2>
                <div class="CommonContent">
                    <div style="line-height: 140%;">
                    
                    </div>
                </div>
            </DefaultContentTemplate>
        </CSControl:ContentPart>

Then go to an rss to java converter site. I used  http://www.rss-to-javascript.com it was the first one i found but it does let you fine tune the way your feed will look. In any case just copy the code it generates and paste it between <div style="line-height and </div> 

 
 Edit note: I have been using this method for a bit now and have noticed that at times the feed does not render and requires a page refresh...its kind of annoying

peace shakes

Carolina Pulse

 
  • Post Points: 5 |
Page 1 of 1 (15 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com