i am creating rss feed for my news and events "http://maceit.visa4u.in/news-and-events.aspx" ..
i am using this razor
@{ //Change mime type umbraco.library.ChangeContentType("text/xml");
//Get the domain var siteURL = "http://" + Request.Url.Host;
//Get the news area node (only one of these per site) var newsAreaNode = Model.NewsAreas.First();
//Get the latest createDate of all news items to use as the RSS feed updateDate var RSSFeedPubDate = newsAreaNode.Children.Where("Visible").OrderBy("updateDate desc").First(); } <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rssdatehelper="urn:rssdatehelper"> <channel> <title>MaceIT News RSS Feed</title>
RSS FEED not creating.. Getting Blank
HI I am having same problem!!
I have been using the code from the Umbraco Razor RSS recipes: http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals/razor-recipes/rss.aspx
my domain http://maceit.visa4u.in
i am creating rss feed for my news and events "http://maceit.visa4u.in/news-and-events.aspx" ..
i am using this razor
@{
//Change mime type
umbraco.library.ChangeContentType("text/xml");
//Get the domain
var siteURL = "http://" + Request.Url.Host;
//Get the news area node (only one of these per site)
var newsAreaNode = Model.NewsAreas.First();
//Get the latest createDate of all news items to use as the RSS feed updateDate
var RSSFeedPubDate = newsAreaNode.Children.Where("Visible").OrderBy("updateDate desc").First();
}
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rssdatehelper="urn:rssdatehelper">
<channel>
<title>MaceIT News RSS Feed</title>
<link>@siteURL</link>
<pubDate>@RSSFeedPubDate.UpdateDate.ToString("r")</pubDate>
<generator>MaceIT News Admin Panel</generator>
<description>Add your description here</description>
<language>en</language>
@{
foreach (var item in newsAreaNode.Children.Where("Visible && NodeTypeAlias=@0", "NewsArticle"))
{
<item>
<title>@item.Name</title>
<link>@item.Url</link>
<pubDate>@item.UpdateDate.ToString("r")</pubDate>
<guid>@item.Url</guid>
<content:encoded><![CDATA[@item.bodyText]]></content:encoded>
</item>
}
}
</channel>
</rss>
but http://maceit.visa4u.in/RSStest1 while using this getting nothing!!!
Umbraco version : 4.9.1
IIS 7
asp.net 4.0
please help me!!
having same issue :(
Just tested this - I've no idea why but razor trips up on the <link> tags.. saying they are not closed properly.
Try replacing the foreach loop with this:
foreach (var item in newsAreaNode.Children.Where("Visible && NodeTypeAlias=@0", "NewsArticle"))
{ @:<item> @:<title>@item.Name</title> @:<link>@item.Url</link> @:<pubDate>@item.UpdateDate.ToString("r")</pubDate> @:<guid>@item.Url</guid> @:<content:encoded><![CDATA[@item.bodyText]]></content:encoded> @:</item> }
is working on a reply...