This project is read-only.

Get blog post's parent blog

Topics: Customizing Orchard
Nov 18, 2013 at 2:30 PM
I customized an alternate view using Content-BlogPost.cshtml and it's working pretty well.

I now want to display some information from the blog post's parent blog. Is there a way to retrieve it from the model exposed in Content-BlogPost.cshtml?

Nov 18, 2013 at 3:07 PM
I was able to do it using the following:
    var blogPostService = WorkContext.Resolve<IBlogPostService>();
    IEnumerable<object> blogPosts = blogPostService.Get(Model.Blog);
Nov 18, 2013 at 5:42 PM
Don't do that from the view. The cleanest way to do this would probably be to add a custom part, whose driver would do that work.
Nov 19, 2013 at 2:18 AM
Thanks for the tip Bertrand. I realize now that this solution, however convenient, is not advisable.

I'll try to follow your suggestion.