Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Darshit 7 posts 50 karma points
    Jan 07, 2013 @ 07:54
    Darshit
    0

    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!!

  • Abdul Raheem 17 posts 61 karma points
    Sep 09, 2014 @ 15:11
    Abdul Raheem
    0

    having same issue :(

  • Steve Morgan 1349 posts 4458 karma points c-trib
    Sep 15, 2014 @ 13:39
    Steve Morgan
    0

    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> }
Please Sign in or register to post replies

Write your reply to:

Draft