This project has moved and is read-only. For the latest updates, please go here.

truncate text in list

Oct 6, 2016 at 4:13 PM
Dippoing my toes in my first template and directly stumbling on an issue I cant easily solve... so here is my question: How would I truncate a text to e.g. 100 characters. E.g. in an announcement setting: list with 100 characters and details with full text.
Help is appreciated. ;)
Oct 6, 2016 at 5:50 PM

Tell me witch kind of template is it ?
  • Razor ?
  • Handlebars ?
  • LIs it a list template ?
  • Based on the standard Articles template ?
Oct 7, 2016 at 9:23 AM
Hi Sacha,

It is a simple handlebars template not based on the article template.

Maybe I better try razor?
Oct 7, 2016 at 10:59 AM

We had already a helper for razor templates for this .
@Satrabel.OpenContent.Components.TemplateHelpers.StringHtmlExtensions.TruncateWords(this string text, int maxCharacters, string trailingText)

I transform it to a HandlebarsHelper : {{truncateWords Description 50 "..."}}


It's available from OpenContent version 3.2.1 released yesterday.