Here is the Parts.Common.Body.Summary.cshtml override that I use on my site:
@{
    Orchard.ContentManagement.ContentItem contentItem = 
Model.ContentPart.ContentItem;
    var bodyHtml = Model.Html.ToString();
    var more = bodyHtml.IndexOf("<!--more-->");
    if (more != -1) {
        bodyHtml = bodyHtml.Substring(0, more);
    }
    else {
        var firstP = bodyHtml.IndexOf("<p>");
        var firstSlashP = bodyHtml.IndexOf("</p>");
        if (firstP >=0 && firstSlashP > firstP) {
            bodyHtml = bodyHtml.Substring(firstP, firstSlashP + 4 - firstP);
        }
    }
    var body = new HtmlString(bodyHtml);
}
<p>@body</p>
<p>@Html.ItemDisplayLink(T("Read more...").ToString(), contentItem)</p>

From: Johan Pieterse [mailto:johan...@microsoft.com]
Sent: Friday, October 07, 2011 4:51 AM
To: orchard-discuss@lists.outercurve.org
Subject: Image part of blog entry summary

Hi *,
Is there a way to include a picture to a listed blog post? Currently my posts 
(by default) only include: the heading, tags, date listed with comments and the 
first two lines of the content.

Reply via email to