/ Published in: C#
                    
                                        
Razor snippet that fetch external RSS feed in Umbraco.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
@using System.Xml.XPath;
@using System.Xml;
@{
//Fetch RSS XML
//Create new XML document
//Load in our remote XML into our XML document
doc.Load(udBrudRSS);
//Select our nodes we want with some xPath
XmlNodeList rssItems = doc.SelectNodes("//item");
}
<ul>
@{
//For each item node we can then ouput what we want
foreach (XmlNode node in rssItems)
{
<li>
<div class="date">@node["pubDate"].InnerText</div>
<a href="@node["link"].InnerText">@node["title"].InnerText<span></span></a>
</li>
}
}
</ul>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                