Displaying a list of Blog Posts

Posted by Community Admin on 03-Aug-2018 21:40

Displaying a list of Blog Posts

All Replies

Posted by Community Admin on 04-Mar-2011 00:00

Hi,

I was having trouble displaying a list of posts from a blog.  The problem is that it is displaying only the version of blog post that is live and not necesarily the most recent version (which would be hidden).  Basically I am trying to figure out what property to group each post by to get the latest version.  Here is a snippet of my code

Dim mostRecent = From s In blog.BlogPosts() _
    Group s By s.id Into g = Group _
    Select id, Version = g.Max(Function(s) s.Version)
 
Dim live_posts = (From s In blog.BlogPosts() _
                  Join q In mostRecent _
                  On q.id Equals s.Id And q.Version Equals s.Version _
                  Where s.Status = ContentLifecycleStatus.Live _
                  Select s)

The first query is returning all blog posts versions and not the most recent version of each blog post.

Regards,

Josh

Posted by Community Admin on 07-Mar-2011 00:00

Hi Josh ,

You are getting only the live content - ContentLifecycleStatus.Live

You can use ContentLifecycle.Master.

Kind regards,
Ivan Dimitrov
the Telerik team

This thread is closed