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:
- Log into your Drupal 7 admin dashboard
- Look to the upper menu bar across the top of the screen. Find and click the Dashboard option.
- 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.
- 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.
- From here you will see the Structure menu options. You want to find and click on the Content Types selection.
- 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.
- 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.
- 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.
- 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.
- 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.
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.
‹Section 2: Promoting an Existing Page to the front page in Drupal 7
›Section 4: How to set the number of posts on front page of Drupal 7
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!