This project is read-only.

API access to URLs of posts

Topics: Business Logic Layer
Aug 24, 2008 at 3:41 PM
Hi all,

     I am using blog engine in my web application for the blogs. The rest of the website is an ASP.NET application. I want to put links to the latest blog posts in the application (on the pages that are outside the blog). Does blog engine expose any APIs that I can use to accomplish this task? I figured out that I could query the 'be_Posts' table in the blog engine database for a list of the blog posts and construct the URL of the post (by appending  /post/<year>/<month>/<slug>). Is there a better way?

Aug 24, 2008 at 7:12 PM
Sure, use the RSS feed i.e.:

string latestPostTitle;
string latestPostLink;

WebRequest http = WebRequest.Create("");
WebResponse response = http.GetResponse();
XmlDocument doc = new XmlDocument();

XmlNodeList items  = doc.SelectNodes("/rss/channel/item");
foreach (XmlNode post in items) {
    latestPostTitle = post.SelectSingleNode("title").InnerText;
    latestPostLink = post.SelectSingleNode("link").InnerText;

... to get the most recent post. I think you can figure out how to get more.

Best regards
Rickard Nilsson
Aug 24, 2008 at 7:18 PM
Edited Aug 24, 2008 at 7:20 PM
But you can also go:


to get the actual object if you want to manipulate it in some way. But then you need a reference to the BlogEngine.Core dll.
Use the post.RelativeLink property to get the href.