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?
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
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();
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;
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com