+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Consuming a Wordpress RSS feed

Consuming a Wordpress RSS feed

4 posts, 0 answered
  1. Craig
    Craig avatar
    1 posts
    Registered:
    21 Nov 2013
    18 Nov 2014
    Link to this post

    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)

  2. Martin
    Martin avatar
    22 posts
    Registered:
    27 Sep 2013
    19 Nov 2014 in reply to Craig
    Link to this post

    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 )
                    {
                    }

                }

            }
        }


  3. Patrick
    Patrick avatar
    1 posts
    Registered:
    14 May 2012
    20 Nov 2014
    Link to this post
    Thanks Martin. I ended up using the Jquery jFeed plugin to parse the feed instead. A lot less hassle.
  4. Dave
    Dave avatar
    29 posts
    Registered:
    27 Aug 2010
    20 Nov 2014
    Link to this post

    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.

    http://www.sitefinity.com/documentation/documentationarticles/user-guide/website-content/creating-and-editing-feeds/creating-a-feed 

4 posts, 0 answered