Copied to clipboard

Flag this post as spam?

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


  • Chris C 43 posts 184 karma points
    Dec 18, 2013 @ 00:30
    Chris C
    0

    Cannot show link in RSS feed macro

    Umbraco 6.x.  Trying to follow the instructions at this URL for building an RSS feed in Razor. 

    http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals/razor-recipes/rss.aspx

    Inside "item" -> "link" it doesn't matter what I put, it always causes the macro to error out.  I can put code like @item.Url or just type "xyz anything", and the macro always errors to "Cannot show partial view script...blah blah". If I leave blank, then it loads.

    I saw on the forums that a couple others had the same problem, but there was no solution.  Help?  Thanks!

     

  • Chris C 43 posts 184 karma points
    Dec 18, 2013 @ 00:35
    Chris C
    0

    Oh, I just saw that in Visual Studio it says "code is not allowed between the opening and closing tags for 'link'".  So.......is there a way around that? 

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    Dec 18, 2013 @ 12:12
    Jeavon Leopold
    0

    Hi Chris,

    Could you please post your code?

    Jeavon

  • Chris C 43 posts 184 karma points
    Dec 19, 2013 @ 17:59
    Chris C
    100

    I came up with a workaround, in case anyone else has this issue. Instead of the link tags, put this -

    @Html.Raw("<link>")http://@item.GetFullNiceUrl()@Html.Raw("</link>")

    Here's the full rss code from the razor macro...

    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0">
    <channel>
        <title>@feedTitle</title>
        <link>http://@blog.GetFullNiceUrl()</link>;
        <description>@description</description>
        <pubDate>@lastUpdated.ToString("r")</pubDate>
        <lastBuildDate>@lastUpdated.ToString("r")</lastBuildDate>
        <language>en</language>
        @{
            foreach (var item in blogPosts)
            {
                <item>
                    <title>@item.Name</title>
                    @Html.Raw("<link>")http://@item.GetFullNiceUrl()@Html.Raw("</link>")
                    <pubDate>@DateTime.Parse(item.GetProperty("PostDate").Value).ToString("r")</pubDate>
                    <guid>@item.NiceUrl</guid>
                    <description><![CDATA[<span>@item.GetProperty("description").Value</span>]]></description>
                </item>
            }
        }
    </channel>
    </rss>   
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies