belniakmedia / craft-excerptify
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.
Installs: 3 035
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:craft-plugin
Requires
- php: >=8.0.2
- ext-dom: *
- ext-mbstring: *
- craftcms/cms: ^4.0|^5.0
Requires (Dev)
- craftcms/phpstan: dev-main
- craftcms/rector: dev-main
This package is auto-updated.
Last update: 2025-02-20 22:58:05 UTC
README
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)
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.