Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

README.md

Truncate

A simple Craft CMS plugin/Twig filter.

Usage

{{ entry.body | truncate('words', '150', '...', true) }}

Params

  • Unit: words or chars. Defaults to chars.
  • Limit: Defaults to 150.
  • Ending: Defaults to an empty string.
  • StripHTML: Removes all HTML tags. Defaults to false

Note

The native Twig filters split, join, and slice can be used to achieve a similar result:

{% set words = "these are words"|split(" ")|slice(1, 2)|join(" ") %}
{{ words }}

About

A simple Craft CMS plugin/Twig filter.

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.