I've been searching and trying for 2 days to change the view for the RecentBlogPosts content type that appears on my homepage. I want to display the title and a phrase from the posts.
I have managed to find a view that shows the title for each post, but I haven't managed to figure out what the other parts in the Model are named or how to extract the text.
Help will be GREATLY appreciated !
@using Orchard.ContentManagement;
@using Orchard.Core.Routable.Models;
@using Contrib.Hyperlink.Fields;
@{
IEnumerable<object> blogPosts = Model.ContentItems.ContentItems;
}
@if (blogPosts == null || blogPosts.Count() < 1)
{
<p>@T("No posts.")</p>
}
else
{
<div class="content-items">
@foreach (dynamic post in blogPosts)
{
string title = post.Title;
ContentItem item = post.ContentItem;
<div class="blogpost" style="width: 300px; padding-left: 15px; float: left;">
<p class="content-item-summary">@Html.ItemDisplayLink(title, item)</p>
</div>
}
</div>
}
The above code was (mainly) from Bertrand Le Roy's blog, for which I thank him.