Reputation: 3
I added a Blog Archive widget to my Orchard CMS blog. It displayed the archive dates as intended and clicking the date displays a list of blog posts that fall under the date. The problem I have is with the list of blog posts that are being shown. They do not seem to follow the regular blog post style. Looking at the source the posts are simply rendered as plain tags without any CSS classes. Using the shape tracing tool tells me that they're simply rendered as the List core shape. I've tried modifying the Blog Archive content part to add a CSS part, but that didn't work. I've create several shape alternates using the tracing tool but none of them worked. Can anyone out there point me to the right direction? Much appreciated.
Upvotes: 0
Views: 593
Reputation: 29
Override ListByarchive View from Orchard.Blogs/Views/BlogPost in your Theme in the view instead of line
@Display(Model.ContentItems)
which renders the archilves list
replace it with
@{
var blogPosts = Model.ContentItems;
var items = blogPosts.Items;
}
///write your own logic here
@foreach (var item in items) {
<div>
@Display(item)
</div>
}
you can see live here
Upvotes: 0
Reputation: 17814
You are right, that list should have a class on it. Please file a bug for it. The fix is simple but requires modification of the blog module. In BlogPostController, after the line saying var list = Shape.List();
, add this:
list.Classes.Add("blog-archive");
Upvotes: 1