Hi Ken,
I will try to explain it in more detail.
The code I posted here should ensure that the
Blog post RSS feed web part will produce one unified link. So, in your case it would produce the link
"Home?rss=blogs", independent of a document the web part is placed on.
In order for this to work, you need to add a new property to the web part and as I wrote in the previous comment, this way an editor will be able to specify the document which will be used in the returned link (in this case Home).
So please open the following file
~\CMSWebParts\Syndication\Documents\CMSRSSFeed.ascx.cs (or the code of the copied web part) and add this code that defines the new property:
public System.Guid NodeGUID
{
get
{
return ValidationHelper.GetGuid(GetValue("NodeGUID"), System.Guid.Empty);
}
set
{
SetValue("NodeGUID", value);
}
}
In order to see this property in the list of Blog post RSS feed web part properties you need to specify a new property also in the Site manager -> Development -> Web parts -> edit the Blog post RSS feed web part or its copy -> Properties -> define a new property:
Attribute name: Document
Attribute type: Text
Attribute size: 100
Display attribute in the editing form: true
Field caption: Document
Field type: Document selectorBy default, the RSS link is generated in the
SetupControl() (~\CMSWebParts\Syndication\Documents\CMSRSSFeed.ascx.cs or the code of the copied web part) method:
rssFeed.FeedLink = UrlHelper.GetAbsoluteUrl(UrlHelper.AddParameterToUrl(UrlHelper.CurrentURL, QueryStringKey, FeedName));So, you will need to replace it with the following code:
CMS.TreeEngine.TreeNode node = null;
UserInfo ui = UserInfoProvider.GetUserInfo("administrator");
CMS.TreeEngine.TreeProvider tree = new CMS.TreeEngine.TreeProvider(ui);
node = tree.SelectSingleNode(NodeGUID, CMS.CMSHelper.CMSContext.CurrentDocumentCulture.CultureCode, CMS.CMSHelper.CMSContext.CurrentSiteName);
if (node != null)
{
string url = CMS.CMSHelper.CMSContext.GetUrl(node.NodeAliasPath, null, node.NodeSiteName);
rssFeed.FeedLink = CMS.GlobalHelper.UrlHelper.GetAbsoluteUrl(UrlHelper.AddParameterToUrl(url , QueryStringKey, FeedName));
}
I hope it makes sense.
Best regards,
Michal Legen