How can I display a list of blog posts in Orchard?

I want a simple widget for my right column, which can display a list of recent blog posts.

Is there an easy way to do this other than creating my own widget? I was looking for a gallery for one and could not find it.

Can someone point me in the right direction?

EDIT: [SOLUTION]

First I added the "Recent Blog Entries" widget. Then I created the Parts.Blogs.recentBlogPosts.cshtml file and placed it in the submission directory of my theme. Here is the contents of the file (taken 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> } 
+7
source share
2 answers

I look at Orchard 1.2 and you have โ€œRecent Blogging Blog Postsโ€ - all you have to do is add it to your preferred level / zone.

+4
source

Besides coding your own view, there are two other ways to customize what is displayed.

  • file Placement.info . You can specify which fields should be displayed for this type of contentType and / or DisplayType (summary or detailed information). You can also specify which order display fields.

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> 
  • Quick Hack - Use CSS to hide content that you don't want. I used this for blogPost metadata before I discovered that place.info

BTW - I donโ€™t know if you are familiar with the designer tools module, but it is priceless!

+2
source

All Articles