Module Description
Smart Trim implements a new field formatter for textfields (text, text_long, and text_with_summary) that improves upon the "Summary or Trimmed" formatter built into Drupal core.

Requirements Drupal contrib modules


* Token
* Token filter (development dependency)

Installation Install and enable Smart Trim as you would any other contributed module. See https://www.drupal.org/docs/extending-drupal/installing-modules

Configuration After installing and enabling Smart Trim, you will see a "Smart trimmed" option in the format dropdown for your text fields. For content types, this is located on the "Manage Display" page. With Smart Trim, you have control over:


* The trim length
* Whether the trim length is measured in characters or words
* Appending an optional suffix at the trim point
* Configuring (optional) "More" link immediately after the trimmed text
* Stripping out HTML tags from the field
* Ability to customize the trimmed content via template override

The "More" link functionality may not make sense in many contexts, and may be redundant in situations where "Read More" is included in set of links included with the node. But it's there if you need it.

As Smart Trim provides a field formatter, use it anywhere field formatters are available, including Layout Builder and Views.

Mission statement Smart Trim is designed to be a focused, lightweight improvement over Drupal core's current formatter trimming capabilities. The maintainers' focus is stability and ease-of-use. Customizations to the module are encouraged with template overrides and Smart Trim hook implementations.

Documentation Getting started (example)

* Navigate to Administration > Extend and enable the module.
* Navigate to Administration > Structure > Content types > Article > Manage display, then click to configure the "Teaser" view mode. (/admin/structure/types/manage/article/display/teaser)
* Select Smart trimmed as the Format for the Body field.
* Click the configuration gear for the Body field.
* Update Smart Trim formatter configuration as desired. Configuration options include:
* Trim by number of characters or words.
* Customize the "More" link.



As Smart Trim provides a field formatter, use it anywhere field formatters are available, including Layout Builder and Views.

Full documentation
https://www.drupal.org/docs/contributed-modules/smart-trim

Maintenance plan The latest release is compatible with Drupal 9 and 10. Drupal 7 is minimally maintained.

Project Usage
63896
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
Smart Trim is designed to improve upon Drupal core's formatter trimming capabilities for textfields.
Data Name
smart_trim

OPENAI CHATBOT

OPENAI CHATBOT

14:30:47
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.