Skip to content

Provides the 'excerptify' twig filter which truncates the provided variable's text or html to the nearest whole word based on the provided character length.

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

BelniakMedia/craft-excerptify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Excerptify Plugin for CMS 3.x

Provides the excertify twig filter which truncates the provided variable's text or html to the nearest whole word based on the provided character length.

Parameters

excerptify(int $characterCount, bool $forceBreakWord)
Parameter Type Default Description
$characterCount Int 200 Number of characters to limit result to.
$forceBreakWord Bool false When false, the text will be broken at the last occurring word break character. When true it will return the text up to the exact character limit, breaking a word if necessary.

Usage Examples

Break at nearest word

This is the default as in the same sas passing no arguments. Will return full words and the resulting string will not exceed 200 characters.

<p>{{ postContent | excerptify(200) }}</p>

To break exactly at the specified character count, even mid word, pass true for the forceBreakWord parameter:

<p>{{ postContent | excerptify(200, true) }}</p>

Brought to you by Belniak Media Inc.

About

Provides the 'excerptify' twig filter which truncates the provided variable's text or html to the nearest whole word based on the provided character length.

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages