Flexible Post Excerpt Display with BlogEngine.NET

I like the look and utility of the excerpt display on my new BlogEngine.NET blog, but the excerpt display didn’t work for my Stylin category.  Each Stylin post contains a screenshot of the featured site, which was being lost in the excerpt display and requiring clicking on each excerpt to see it.  Not very efficient, so I needed to display the full post on this category in the post lists, but excerpts elsewhere. 

In Community Server I did a similar mod, achieving the full Stylin post display by creating a mirrored blog of my Stylin Category and creating a derivative theme to display the full post.  In BE.NET there was a somewhat more simple solution. 

The post list display is set in BE.NET’s admin settings page seen here. 

 

In the PostList.ascx.cs control, the post display is set by checking that setting.

postView.ShowExcerpt = BlogSettings.Instance.ShowDescriptionInPostList;

 

To achieve my flexible excerpt display I added logic to determine if the post’s category was “Stylin” and if the page was a category post list, since PostList.ascx is used by other post list pages as well. 

Nothing fancy here, and there is probably a cleaner way to code this, but part of the fun was seeing how quickly I could do the mod, which turned out to be about 15 minutes from the point of looking at the code behind the admin settings page to updating the PostList.ascx and uploading the .cs file to my site. 

To view the Stylin full posts I’m talking about, click on the sidebar “Stylin” category link.

 

Now I can throw up some more Stylin posts!

Article written by

A long time developer, I was an early adopter of Linux in the mid-90's for a few years until I entered corporate environments and worked with Microsoft technologies like ASP, then .NET. In 2008 I released Sueetie, an Online Community Platform built in .NET. In late 2012 I returned to my Linux roots and locked in on Java development. Much of my work is available on GitHub.