How do I show recent blog entries from my WordPress site inside a webpage?

on an asp.net-mvc website page, i want to show recent blog posts from a wordpress blog.

Similar to this site, i want to show the last few updates of a particular wordpress blog on my website. kind of like what google reader does i guess, but just for one site and for long posts it should only show a little and have a “click for more” link.

Read More

is that something I subscribe on the server and return the html or is it something i should be doing on the client side with jquery ??

Related posts

Leave a Reply

1 comment

  1. Since WordPress provides rss feeds you can use them to get the latest posts. The feed is located at http://yourblog.com/feed.

    Parsing this feed is a simple task thanks to SyndicationFeed class. Here’s an example:

    var reader = XmlReader.Create("http://nyqui.st/feed");
    var feed = SyndicationFeed.Load<SyndicationFeed>(reader);
    
    Console.WriteLine("Latest posts from " + feed.Title.Text);
    foreach(var item in feed.Items)
    {
        Console.WriteLine(item.Title.Text);
    }
    

    Limiting the posts is a trivial task. Check the length of the text and if it’s longer than your threshold, use string.Substring(0, <limit>) to cut it.