开发者

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 开发者_StackOverflowposts.


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>


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜