Consuming a Wordpress RSS feed

Posted by Community Admin on 04-Aug-2018 04:11

Consuming a Wordpress RSS feed

All Replies

Posted by Community Admin on 18-Nov-2014 00:00

Hi - I've setup an external Wordpress RSS feed as a feed in SiteFinity. I'm publishing the feed out into SiteFinity as a blog as I couldn't find a control to just display a few posts from an external RSS feed??

The problem is that when I click the blog post title, it loads load a SiteFinity URL instead of the URL of the post on the Wordpress site (i.e. the external link). Is there a way to retain the Wordpress URL?

 (using v4.2)

Posted by Community Admin on 19-Nov-2014 00:00

Hi Craig

 I had a similar question/issue recently and created a usercontrol to read the RSS feed...

This simple example has a public property (FeedXML) to set for the feed.

And an optional item title to "filter" the items

You can probably expand on this to get what you need...

Regards

Martin

Control Markup

<asp:XmlDataSource ID="XmlDataSource1" runat="server">
</asp:XmlDataSource>
 
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="">
 
    <ItemTemplate>

        <article class="content_detail">
            <h1>
               <%#XPath("title")%>
            </h1>
            <%#XPath("description")%>
        </article>    
 
    </ItemTemplate>
 
    <SeparatorTemplate>
        <hr/>
    </SeparatorTemplate>
 
</asp:Repeater>

Code Behind

        public string FeedXML
       
            get; set;
       
        public string ItemTitle
       
            get;
            set;
       
        public string ItemGuid
       
            get;
            set;
       

        protected void Page_Load(object sender, EventArgs e)
       
            if (!this.Page.IsPostBack)
           

                try
               
                    if (this.FeedXML != null && this.FeedXML.Length > 0)
                   
                        this.Repeater1.DataSourceID = "XmlDataSource1";

                        this.XmlDataSource1.DataFile = FeedXML.Trim();
                        if (this.ItemTitle != null && this.ItemTitle.Length > 0)
                       
                            XmlDataSource1.XPath = "rss/channel/item[title='" + ItemTitle.Trim() + "']";
                       
                        else
                       
                            XmlDataSource1.XPath = "rss/channel/item";
                       

                        XmlDataSource1.Data = "XmlDataSource1";
                        XmlDataSource1.DataBind();
                   
               
                catch (Exception ex )
               
               

           

       
   


Posted by Community Admin on 20-Nov-2014 00:00

Thanks Martin. I ended up using the Jquery jFeed plugin to parse the feed instead. A lot less hassle.

Posted by Community Admin on 20-Nov-2014 00:00

A little known but very powerful feature of Sitefinity is the ability to import content from RSS feeds.  With it you can create a blog in Sitefinity and import the content from your WordPress blog via a RSS feed. Once you have the content in Sitefinity you can use Sitefinity's Blog Widget. This will also give you the ability to assign Sitefinity tags and categories.

The key setting is "Publish As". This is where you specify that you want the feed imported into your Sitefinity blog.

www.sitefinity.com/.../creating-a-feed 

This thread is closed