How to create own link to blog's RSS feed

rated by 0 users
Answered (Not Verified) This post has 0 verified answers | 3 Replies | 2 Followers

Top 200 Contributor
116 Posts
Points 1,535
clarkrb posted on Tue, Aug 26 2008 11:17 AM

On the side of the blog there's a widget that has a link to the RSS feed for the blog currently being viewed. I'd like to create my own links elsewhere on the page, but need to know how to retrieve the URL of the RSS feed for the current blog. How would this be done?

  • Filed under:
  • | Post Points: 20

All Replies

Top 10 Contributor
3,559 Posts
Points 53,735
TelligentSupportTeam
Suggested by Alex Crome

For a chameleon control try

<CSBlog:WeblogData runat="server" Property="Name" LinkTo="Rss" />

To obtain the URL programatically, have a look at the BlogUrls class (I think it's in CommunityServer.Blogs.Components, but don't hold me to that.  It's definitly somewhere in CommunityServer.Blogs though)

Community Server Documentation please rate articles you read

Nintendo Wiikly | My Blog

  • | Post Points: 20
Top 200 Contributor
116 Posts
Points 1,535
clarkrb replied on Tue, Aug 26 2008 10:14 PM

Thanks for providing some direction afscrome. Since the CS documentation is no help at all, I used Reflector to try and narrow down my choices. I tried the following in the Page_Load event of my post.aspx page, but it returns nothing.

CommunityServer.Blogs.Components.WeblogPost p = CommunityServer.Blogs.Controls.WeblogControlUtility.Instance().GetCurrentWeblogPost(this);

litRSS.Text = p.Weblog.ExternalFeedUrl.ToString();

  • | Post Points: 20
Top 10 Contributor
3,559 Posts
Points 53,735
TelligentSupportTeam

Why are you using reflectof for the parts of the CommunityServer.Blogs - the Source code for those is freely available in the SDK.

I've copied the folowing code from the WeblogData control, for the control is set to Link To the RSS feed.  There's probably more going on there than you need but it's easier to filter out stuff you don't need than to add stuff that you do need in

if (weblog.EnableRss)
{
 if (weblog.Hub != null)
 {
  if (Permissions.ValidatePermissions(weblog, Permission.View, Users.GetAnonymousUser(true)))
  {
   link = new HyperLink();
   link.NavigateUrl = BlogUrls.Instance().HubRss(weblog.Hub.ApplicationKey);
   string autoDiscoveryTitle = string.Format("{0} - {1}", weblog.Hub.Name, ResourceManager.GetString("Button_Weblog"));
   Head.AddRssAutoDiscovery(autoDiscoveryTitle, link.NavigateUrl, this.Context);
  }
  else if (!csContext.User.IsAnonymous && csContext.SiteSettings.EnableSecureSyndication)
  {
   link = new HyperLink();
   link.NavigateUrl = SiteUrls.FormatUrlWithUserNameToken(BlogUrls.Instance().HubRss(weblog.Hub.ApplicationKey), csContext.User);
   string autoDiscoveryTitle = string.Format("{0} - {1}", weblog.Hub.Name, ResourceManager.GetString("Button_Weblog"));
   Head.AddRssAutoDiscovery(autoDiscoveryTitle, link.NavigateUrl, this.Context);
  }
  else
   this.AutomatedVisible = false;
 }
 else if (!string.IsNullOrEmpty(weblog.ExternalFeedUrl))
 {
  link = new HyperLink();
  link.NavigateUrl = weblog.ExternalFeedUrl;
 }
 else if (Permissions.ValidatePermissions(weblog, Permission.View, Users.GetAnonymousUser(true)))
 {
  link = new HyperLink();
  link.NavigateUrl = BlogUrls.Instance().Rss(weblog.ApplicationKey);
 }
 else if (csContext.SiteSettings.EnableSecureSyndication)
 {
  link = new HyperLink();
  link.NavigateUrl = SiteUrls.FormatUrlWithUserNameToken(BlogUrls.Instance().Rss(weblog.ApplicationKey), csContext.User);
 }
 else
  this.AutomatedVisible = false;
}
else
 this.AutomatedVisible = false;

Community Server Documentation please rate articles you read

Nintendo Wiikly | My Blog

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

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