How can I replace a blog post summary with full blog post?

Topics: Customizing Orchard
Oct 16, 2011 at 5:32 AM

I am running my blog site on orchard version 1.3 and I would like my blog posts to be displayed in full instead of just a snippet with "More.." or "Continue Reading..." at the bottom of the first paragraph (my blog site is here if this is not clear -  How can I achieve this?  I started looking into using Placement.Info to accomplish but still trying to grasp how to accomplish this using that - do i need to take a different approach perhaps?

Oct 16, 2011 at 6:00 AM
Edited Oct 16, 2011 at 6:00 AM

Here is the Parts.Common.Body.Summary.cshtml I'm using for that:

    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>@Html.ItemDisplayLink(T("Read more...").ToString(), contentItem)</p>

If you just want the full text, it's even simpler:

<p>@(new HtmlString(Model.Html.ToString()))</p>
Oct 16, 2011 at 3:29 PM

ok thanks!  And also for such a quick reply!  That works and answers my question exactly as I asked it, but what I am really looking for is to replace all the "summary" stuff with the full "blog post" stuff on the home page - so something similar to where the full post is always displayed w/comments, etc below it.  By playing with the Parts.Common.Body.Summary.cshtml I have also added comments and social networking stuff to the summary page, but I next need to get the font styles to match.  I can keep tweaking this way, but not sure if there is a better way to come at this problem.  Is there any way I can have the "blog-post details" show from the get-go instead of tweaking the "summary" to match it?  Or will I need to modify the Blog Module, and essentially locking myself out of automatic updates to that module?  Perhaps there is a property on the blog module to handle this?

Oct 16, 2011 at 9:26 PM

Yes, there is a way to do this, which is to intercept the shape from some event in a handler and switch the display type back from summary. If you have a project file in your theme, you could even do that from the theme.

Oct 16, 2011 at 10:33 PM
Edited Oct 17, 2011 at 12:40 AM

ok thanks.. I'll start digging into it.  I do have a project file for my theme, and that sounds like the cleanest approach here as when upgrading I'll copy my customized theme to the new version anyway.  Any examples you can point me to offhand?  


I found this post..  sounds like it might be what I need but haven't tried it out yet.  Filter content items, blog posts, everything based on user profile value or role