Render Comments Part when Blog is already overriden

Topics: Customizing Orchard
Oct 10, 2011 at 4:56 PM

 I am trying to render the Comments Part of a Blog Post after I already have overriden the BlogPost content type. I have a template file for blog posts called:


Inside this file I am rendering a blog post in a custom way. I am able to grab the comments part like this:

var comments = ((IContent)Model.ContentItem).As<CommentsPart>();

But now to render the comments by hand I need to know how to call the Render Engine here. I am trying this:


But it is not working. Any help would be great.

I saw a blog post with something like this for tags though:

@Display(New.MyCommentShape(Comments: comments.Comments))

Oct 10, 2011 at 5:01 PM

Display works on shapes, not content items, so you need to grab the shape that already exists for the comments. See

Oct 10, 2011 at 5:40 PM

Thanks! This worked. I had to make a couple of edits:

In my template I had to cast Model to Shape before passing it. Then in Util I modified the argument to be be Shape instead if IShape.

@Display(ShapeHelper.Find((Shape)Model, "Parts_Comments"))

public static dynamic Find(Shape model, string name)