Knowledgebase

How to change the summary length of content types in Drupal

In Drupal content types can be configured to be displayed on the frontend first in a preview/teaser form with a short summary, and when the customer clicks on the particular content item the full content is shown. For example, the article content type that comes preconfigured with Drupal is set up in this way. In this case the settings of the content type are configured to automatically trim the beginning of the article and display it as the summary/teaser. The length of the trimmed part is also configured in the settings of the content type.

When you create or edit an article, from the settings of the particular article you can choose explicitly to include a summary. In this case the summary can be of any length you choose. It will only be displayed in the teaser view on the frontend. To do this, when you create/edit the article just click on the Edit summary link that's above the text area for the body of the text, and type the summary in the new text area that appears.

However, from the general settings for the content type you can change the length of the part that is automatically trimmed as the summary. Let's say that you want to do it with the default article content type. After you log in to the admin panel of your Drupal application, click on the Structure tab in the top navigation bar, on the page that opens click on Content types, and on the following page click on the edit button for the particular content type (in our example article). A page with the global settings for this content type will appear. Above the top right corner of the panel there should be several tabs; click on the one labeled Manage Display. On the page that opens you'll see a table. Just above the top right corner of the table there should be two small buttons. Click on the one called Teaser. On the next page again there's a table; for the field Body you'll see specified the trim length. This is the length of the automatically trimmed summary. In the case with the article content type it's 600 by default.

To change it click on the button that's right next to the value for the trim length. A text field will appear. Type the new value in it and click on the Update button that's just beneath the field. After that don't forget to click on the Save button that's below the table to save the new configuration. This change is global which means that it will apply to all content items that belong to the particular content type (e.g. article).

Was this answer helpful?

 Print this Article

Also Read