New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Clamp.js doesn't work with Statamic's {{ x }} content. Any other solutions?

Michael Mannucci July 24, 2019 by Michael Mannucci

Hi all! New to the forum. Learning Statamic and loving it. I have a question about Clamp.js. For those who are not familiar, Clamp.js lets you set the amount of lines you want text to span before gets cut off with an ellipsis. This is useful for many things, but in my case, I have created blog cards that have the title and preview text of a post. If a post is 1500 words, Clamp.js would limit it to load only 3 lines before it trails off with ellipsis.

Now, it works just fine if I use it on a regular div or p, but when I try to do it on any dynamic {{ content }}, it no longer works.

Does anyone know why it doesn't work, how to fix it, or have an alternate solutions to preview the first few lines of a blog post?

Answered by Ben Furfie!
>>>>>>> Answered <<<<<<<
3 Replies