I want a simple widget for my right side column that can display a list of recent blog posts.
is there an easy way to do this other than creating my own widget? i've searched the gallery for one and wasn't able to find one.
can someone point me in the right direction?
EDIT: [SOLUTION]
First I added the Recent Blog Posts widget. Then I created a file Parts.Blogs.recentBlogPosts.cshtml and placed it under the Views directory of my theme. Here's the contents of the file (taken from here: http://weblogs.asp.net/bleroy/archive/2011/03/27/taking-over-list-rendering-in-orchard.aspx)
@using Orchard.ContentManagement;
@{
IEnumerable<object> blogPosts =
Model.ContentItems.ContentItems;
}
@if (blogPosts == null || blogPosts.Count() < 1) {
<p>@T("No posts.")</p>
}
else {
<ul class="content-items">
@foreach (dynamic post in blogPosts) {
string title = post.Title;
ContentItem item = post.ContentItem;
<li class="content-item-summary">
@Html.ItemDisplayLink(title, item)
</li>
}
</ul>
}
I'm looking at Orchard 1.2 and there is a 'Recent Blog Posts Widget' available to you - all you need to do is add it to your preferred layer/zone.
Other than coding your own view, there are two other ways to customize what is shown.
From the sample file in the thememachine theme.
<Match ContentType="Blog">
<Match DisplayType="Summary">
<Place Parts_Blogs_Blog_Description="Content:before"
Parts_Blogs_Blog_BlogPostCount="Meta:3"/>
</Match>
</Match>
BTW - I don't know if your familiar with the designer tools module, but it's invaluable!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With