Copied to clipboard

Flag this post as spam?

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


  • Rowena Bellamy 17 posts 118 karma points
    Dec 08, 2020 @ 14:47
    Rowena Bellamy
    0

    Consuming RSS feed in Umbraco 8

    Hi guys - hoping someone can point me in the right direction. I need to consume the contents of an RSS feed into the content of a page in a way that it is indexable by the search.

    I've had a hunt around and although there seem to be lots of packages historically which did this, I can't find anything useful for v8, or actually anyone else who's had to solve this for a while.

    Anyone tackled a similar problem? Thanks v much in advance.

  • Amir Khan 1282 posts 2739 karma points
    Dec 08, 2020 @ 14:55
    Amir Khan
    0

    This shouldn't be version dependent(ish), this a rough shell to render an XML feed of any kind with a macro, you could probably adapt it slightly to use a regular partial.

    @using System;
    @using System.IO;
    @using System.Xml.XPath;
    @using System.Xml;
    @using umbraco.MacroEngines;
    @inherits umbraco.MacroEngines.DynamicNodeContext
    
    @{
        //Request Query String if needed
        int archiveYear = Request.QueryString["archiveYear"].AsInt();
    
        //Fetch RSS XML
        XmlTextReader feedUrl = new XmlTextReader("url to your rss feed");
    
        //Create new XML document
        XmlDocument doc = new XmlDocument();
    
        //Load in our remote XML into our XML document
        doc.Load(feedUrl);
    
        //Select our nodes we want with some xPath
        XmlNodeList feedItems = doc.SelectNodes("//node to render");
    
    }
    <ul>
        @{
            //For each item node we can then ouput what we want
    
            foreach (XmlNode node in feedItems)
            {
                <h1>render stuff here</h1>
    
    
    
            }
    
        }
    </ul>
    
  • Rowena Bellamy 17 posts 118 karma points
    Dec 08, 2020 @ 15:02
    Rowena Bellamy
    0

    Thanks Amir, that's really helpful and I'll keep it on file.

    Reading this I've realised that the challenge that I have (and sorry I didn't make this clearer), is that I need the content to be indexable, so if I render it out on the template the search won't know about it.

    I've read CMSImport might be able to help, but it doesn't seem to be supported in V8 as far as I can see.

  • Huw Reddick 1756 posts 6121 karma points MVP c-trib
    Dec 08, 2020 @ 15:30
    Huw Reddick
    0

    You could just import your rss feed items into a document, that is how we deal with the products in our shop (the products come from a crm system) and create documents of type product when they are imported. (I have a manual job to refresh them, but you would probably want to automate that part perhaps.

    You should then be able to deal with them as you do any other document type in Umbraco

  • Amir Khan 1282 posts 2739 karma points
    Dec 08, 2020 @ 19:33
    Amir Khan
    100

    We definitely have used CMS import to import RSS feeds on a schedule in the past. It looks like there was a release for v8 though I'm not seeing a download button or link to our. anywhere: https://soetemansoftware.nl/news/cmsimport-v4-released

  • Amir Khan 1282 posts 2739 karma points
    Dec 08, 2020 @ 19:36
    Amir Khan
    0

    Apparently can't see today, here's the download for the trial and the RSS provider: https://soetemansoftware.nl/cmsimport/downloads

  • Rowena Bellamy 17 posts 118 karma points
    Dec 09, 2020 @ 08:46
    Rowena Bellamy
    0

    Thanks Amir, I had a play with CMSImport last night and although it's not going to work how I planned, I can certainly get it to work. Thanks for your help ! :)

Please Sign in or register to post replies

Write your reply to:

Draft