Smart Trim

Module Drupal Illustration Voir sur
Nb téléchargements : 64131


  • Code
  • Documentation
  • Miscellaneous
  • User interface





permet de couper des champs texte


Status : Published
Projects : Modules
Maintenance status : Actively maintained
Development status : Under active development
Supported Branches : 2.1.
shield Stable releases for this project are covered by the security advisory policy.


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.


Drupal contrib modules


Install and enable Smart Trim as you would any other contributed module. See


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.


Getting started (example)

  1. Navigate to Administration > Extend and enable the module.
  2. Navigate to Administration > Structure > Content types > Article > Manage display, then click to configure the "Teaser" view mode.
  3. Select Smart trimmed as the Format for the Body field.
  4. Click the configuration gear for the Body field.
  5. 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

Maintenance plan

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

Toutes les informations proviennent du site