Home Tip of the day. Truncating handlebars
Post
Cancel

Tip of the day. Truncating handlebars

TIP: easiest way to truncate some text using handlebars

1
 {{ellipsis "<span>foo bar bar bar</span>" 7}}

results in

"foo bar..."

Or when you need to be sure some item text value is not too big, like news summary spfx webpart:

1
2
3
4
5
6
7
8
9
10
11
  {{#gt Item.textValue.length 50}}

    {{ellipsis Item.textValue 50}} 

    <button>Read more</button>

  {{else}}

    {{Item.textValue }}

  {{/gt}}
This post is licensed under CC BY 4.0 by the author.

Get and compare documents hash from different tenants

Tip of the day. Display multilanguage content