CMS Development

LDouglas8
Member

Limit number of characters on a text widget

SOLVE

So I have a text widget that I'm using to add text content to a Hubspot site. The client needs that it's able to be capped at a certain number of characters, say 400 so that one can not type beyond the specified number of characters. 

 

Here is a screenshot of the widget that I'm talking about. 

In the Design toolsIn the Design toolsHow it looks like on the Landing pageHow it looks like on the Landing page

The idea is that one shouldn't be able to type past a certain number of characters.

1 Accepted solution
felixmacaspac
Solution
Contributor

Limit number of characters on a text widget

SOLVE

Hey @LDouglas8 based on my experience I think it's impossible to limit the characters in the content editor. Alternatively, what you can do is use the truncate hubL filter.

 

you can do something like this:

 

 

{{ module.text|truncate(400) }}

 

 

more details in the documentation:

https://developers.hubspot.com/docs/cms/hubl/filters#truncate

View solution in original post

1 Reply 1
felixmacaspac
Solution
Contributor

Limit number of characters on a text widget

SOLVE

Hey @LDouglas8 based on my experience I think it's impossible to limit the characters in the content editor. Alternatively, what you can do is use the truncate hubL filter.

 

you can do something like this:

 

 

{{ module.text|truncate(400) }}

 

 

more details in the documentation:

https://developers.hubspot.com/docs/cms/hubl/filters#truncate