My problems with adidng Lead Story user control

Topics: Themes
Jul 12, 2012 at 1:03 AM

I added a Lead Story user control that handles the showing of a Lead story above all the other posts. There are a couple of issues that I have not solved:

1) The Lead Story is duplicated below with all the other posts. I need to exclude the Lead Story from the list of posts. I thought something like if Post.Category == "Lead Story" would work but Category does not seem to directly accessible. 

2) So far I can only get the Lead to show up with I have not been able to get it to show up with Any thoughts? 

Jul 12, 2012 at 2:02 AM
Edited Jul 12, 2012 at 2:03 AM

OK solved the url problem. Still having trouble with the duplicated Lead Story. I am using Skip now as in:

public IList<Post> Skip1stPost()
        IList<Post> tmp = new List<Post>();
        tmp = (from t in Post.Posts select t).Skip(1).ToList();
        return tmp;


But I am stuck as to what to do next. If I do this.Post = Skip1stPost I get a Cannot implicitly convert type error.

Jul 12, 2012 at 4:40 AM

What you can do is in your theme's PostView.ascx check if current post within category you want to exclude:

    bool leadCategoryPost = false;
    foreach (BlogEngine.Core.Category category in Post.Categories)
        if (category.Title == "Lead Story")
            leadCategoryPost = true;
And then only show anything if it is not in that category:

<% if(!leadCategoryPost){ %>
<div class="post xfolkentry" id="post<%=Index %>">
.. all the post HTML
<% } %>