Matthew Kruskamp
Matthew Kruskamp

Reputation: 1887

Can I make Orchard show the entirety of a blog post in the blog list?

I just set up Orchard and noticed that the preview widget only shows the first couple sentences with the standard "more" link. Is there a way to override this functionality without creating a custom widget? I would like Orchard to show the entirety of my latest five posts.

Upvotes: 10

Views: 2042

Answers (2)

Josh Schultz
Josh Schultz

Reputation: 8190

I wanted to do something similar without overriding the Common.Body.Summary part for the whole site. I only wanted BlogPosts to use the full HTML for the Summary. I think I've accomplished this by adding the following line to Placement.info:

<Match ContentType="BlogPost">
    <Match DisplayType="Summary">
        <Place Parts_Common_Body_Summary="Content:after;Alternate=Parts_Common_Body"/>
    </Match>
</Match>

Upvotes: 9

Bertrand Le Roy
Bertrand Le Roy

Reputation: 17814

Sure, just put this Parts.Common.Body.Summary.cshtml in the views directory of your theme:

@{
    Orchard.ContentManagement.ContentItem contentItem = Model.ContentPart.ContentItem;
    var bodyHtml = new HtmlString(Model.Html.ToString());
}

<p>@bodyHtml</p>

Upvotes: 9

Related Questions