TopShelfCraft / Wordsmith

A plugin for Craft CMS to help you manage and manipulate text.
Other
30 stars 20 forks source link

Add `cutoff` Parameter #11

Open jalendport opened 6 years ago

jalendport commented 6 years ago

We should add the cutoff parameter found in the original version of Hacksaw back in (both for legacy reasons and also because it might prove useful in some cases).

Another way to limit content is by a cutoff string. This is similar to the way WordPress's "more" feature works. In your content you could add a specific string to indicate the spot you want the excerpt to stop. Let's say you want to use <!-- END --> to cut the excerpt off at that location; you would do this:

{{ entry.richTextField | hacksaw (cutoff='<!-- END -->') }}