More in this section
Blogs RSS feed

Formatting Sitefinity 4.x content summary

by User Not Found

Back in Sitefinity 3.x control designers for content view controls allowed you to set Summary Settings for your list view, which allowed you to cut of the first N words from the content item's content or other meta field. This is described on Sitefinity Watch here: Formatting your Sitefinity Blog Summaries. In this blog post I am going to show you how you can do this with Sitefinity 4.x by editing widget templates from the widget editor.

Lets say that we want to set our Blog Posts control to show the first 100 words from the content of our blog posts when we are viewing the blog posts list. We will edit the default template for the lists view. This can be done either by going to Design -> Widget Templates and selecting the relevant template for edit, or by modifying the template directly from the Blog Posts control. Bellow is what you have to do:

1) Add an import statement to register the SummaryParser's namespace (last line of the markup below):

<%@ Control Language="C#" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.Comments" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Import Namespace="Telerik.Sitefinity" %>   
<%@ Import Namespace="Telerik.Sitefinity.Data.Summary" %>  

2) Substitute the default field control for displaying blog post content.


<sf:FieldListView ID="PostContent" runat="server" Text="{0}" Properties="Content" WrapperTagName="div" WrapperTagCssClass="sfpostContent" />


<sitefinity:HtmlField runat="server" DisplayMode="Read" Value='<%# SummaryParser.GetSummary(Eval("Content").ToString(),new SummarySettings(SummaryMode.Words,100,false,false)) %>' />

With the current summary settings my blog posts list is going to display the first 100 words of a blog post.


Leave a comment
  1. Thomas Oct 13, 2011
    Thank you very much Rado! That's what I missed from the old 3.x days.
  2. blogpost Dec 28, 2011
    Sorry, to let you know that this does not work! it breaks the code on my page and gives me an error saying "Telerik.Web.UI.Editor is undefined". Come on do something sensible, tried of spending time on fixing things rather than doing new development work!
  3. Stewart Jul 01, 2014


    I need to implement the same author profile as shown in this post. How do I do that.

  4. Radoslav Jul 01, 2014

    Hi Stewart,

    You can use the profiles from Sitefinity and expose the necessary extra fields such as Author Bio, Google + profile URL, etc. After this it is relatively easy to make a control which will get bound to the article's owner and will pull all the necessary profile information and then output it in compatible format for authorship. 

    At any rate, open a new forum thread or raise a ticket with our support team and they will provide you with a working sample.

    Leave a comment