Changing the content preview length on the front page in Drupal 7

The front page of your Drupal site is often used to display content previews for your other pages. You may have seen this on the front page of other blogs or magazine sites. Visitors are able to review a portion of the content and click on the title if they are interested in reading the full article.

By default, Drupal 7 sets this preview limit to 600 characters. You may wish to customize your content preview to show either a bit more or a bit less, depending on your individual tastes. In previous versions of Drupal, this setting was called Length Of Trimmed Posts. In Drupal 7, both the location and name of the setting has changed. It is now known as Trim Length. To change the amount of characters shown on the front page for content preview in Drupal 7, follow the instructions below.

How to modify the Trim Length setting in Drupal 7:

  1. Log into your Drupal 7 admin dashboard
  2. Look to the upper menu bar across the top of the screen. Find and click the Dashboard option.
    dashboard

  3. You should now see a screen for the Dashboard. At the top left of this page (or overlay if you have it enabled) you will see the Home > Administration links. Click on the Administration link.
    admin-link

  4. Now you are on the Administration page and see a new menu on the screen. Click on the Structure option to go to the next page.
    admin-struct

  5. From here you will see the Structure menu options. You want to find and click on the Content Types selection.
    admin-struct-type

  6. From here, you will see the different content types you have enabled for your Drupal 7 installation. You will see at least the two default types (Articles and Basic Pages). There may be more types listed if you have enabled modules for them. The Trim Length can be set for each content type. From here, choose your content type and select the Manage Display link for that content type. For this tutorial, I am selecting the Manage Display for the Basic Pages content type.
    admin-struct-type-page

  7. This leads to the Basic Page settings. Look for the tab that is labeled Teaser and click that. This tab is in all content types just under the page title on the left hand side.
    admin-struct-type-page-tease

  8. From the Teaser page you will see a setting labeled Trim Length followed by a number, which is the current setting. To the right you will see a small gear icon. Click the gear icon to expand that section to allow you to change the setting.
    admin-struct-type-page-tease-gear

  9. From the expanded section, you will see a field where you can enter the new setting. This has a lower limit of 1 and, while the ‘unlimited’ setting has been removed in Drupal 7, has an upper limit of 99999999999999999 (that’s seventeen 9’s in a row), making it effectively unlimited. Enter your desired preview limit. We changed the example from the default 600 to 100. Once you have entered your value click on the Update button just below, collapsing the editing area.
    admin-struct-type-page-tease-trim

  10. Click on the Save button at the bottom to save the updated settings. You can now view your newly set preview limit by visiting the front page of your site.
    BeforeAfter
    preview-content-before

    preview-content-after

You may want to repeat the process for the other content types in your site as well. You are now familiar with setting the Trim Length setting in Drupal 7.

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X