0

I want to display just a short blurb from each blog entry. I dont know how to display my { entry.blogentry } without having all of the text show up.

Is there a way to just show the first 100 characters OR first few lines?

3

You can use the Twig slice filter do do this, e.g.: entry.text |slice(0, 100)

If you want something that looks a little nicer, and you're using the SEOmatic plugin, you can use the truncateStringOnWord filter, which will truncate to the number of characters you want, but only on word breaks (and it'll add an …).

2
  • I put in {{entry.blogentry | slice(0, 40 )}} but I get the <p> tags and all that. I might have to try that SEOmatic plugin but would like to try something else.
    – kingkelly
    Oct 19 '17 at 20:23
  • Speaking from experience, your best bet is to use SEOmatic. It is pretty fantastic.
    – Damon
    Oct 20 '17 at 4:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.