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

Forums / General Discussions / Displaying a list of Blog Posts

Displaying a list of Blog Posts

2 posts, 1 answered
  1. Josh
    Josh  avatar
    25 posts
    Registered:
    28 Apr 2009
    04 Mar 2011
    Link to this post
    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
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    07 Mar 2011
    Link to this post
    Hi Josh ,

    You are getting only the live content - ContentLifecycleStatus.Live

    You can use ContentLifecycle.Master.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Answered
2 posts, 1 answered