Teaser

The node.teaser view mode: the listing display of a node, which core's content types fill with the body summary or a trimmed body.

Learn DrupalDrupal glossary

A teaser is the short version of a content item that Drupal shows in lists, such as the front page or a topic page. The user guide's example shows a thumbnail image and a Read more link to the full page. A teaser is not a field but a view mode named Teaser, which every content type configures on its own.

How teasers work in Drupal 11

The node module ships a view mode with the ID node.teaser and the label Teaser. The user guide describes view modes as the context that decides how an entity is displayed. On the Manage display page of each content type you switch between view modes at the top, and the Custom display settings section decides whether a view mode uses its own settings or the default ones.

Core's Article and Basic page content type recipes give the Teaser display the body with the formatter text_summary_or_trimmed (Summary or trimmed), label hidden, plus the Links component. That formatter works like this:

  • If the editor filled in the summary, Drupal shows the summary.
  • If not, it trims the body to the Trimmed limit, 600 characters by default, and cuts at a natural break before the limit.
  • For the cut, TextSummary looks for the end of a paragraph first, then a line break, then the end of a sentence.

When the Teaser display shows the Links component, NodeViewBuilder always adds a Read more link, because core cannot tell whether the teaser differs from the full view.

Core uses teasers in three places. The Frontpage view lists promoted content as teasers at /node, the taxonomy term view does the same on each term page, and the Views wizard offers teasers as a display format for content listings. In a theme, node--teaser.html.twig overrides the markup; Olivero ships such a file. The old teaser template variable is deprecated in Drupal 11.1.0 and scheduled for removal in 12.0.0; use view_mode.

Example

Go to Structure › Content types, choose Manage display for your content type and open the Teaser tab. Put the image field above the body and keep the body on Summary or trimmed. Then edit a node of that type and use Edit summary in the body field to write a two-sentence teaser by hand. A list that uses the Teaser mode, such as the front page, now shows your sentences instead of an automatic cut.

Common mistakes

  • Trusting the automatic cut. It can end after a sentence that makes no sense alone. Write the summary for pages that matter.
  • Hiding the Links component. The Read more link belongs to it, so the teaser loses its link to the full page.
  • Using the teaser variable in a new template. It is deprecated; compare view_mode with 'teaser'.

For marketing and content teams

In a listing, the teaser is what a visitor reads before choosing to click. Give important content its own summary, keep it to a sentence or two, and check the front page and topic pages after you publish. Ask your developer which fields the Teaser mode shows, so that the image and the first words fit the listing.

Sources

Questions about Teaser

No. A teaser is a view mode, a named way of displaying an entity. Each content type chooses which fields the Teaser view mode shows and with which formatters. The summary part of a body field is a separate thing: the Summary or trimmed formatter can use it in the teaser.

On the content type's Manage display page, open the Teaser view mode and edit the settings of the body formatter. The Trimmed limit is 600 characters by default. If the editor filled in the summary, the Summary or trimmed formatter shows that text instead and ignores the limit.

The Teaser view mode may be using the default display, or the body formatter may be Default instead of a trimmed one. Check the Custom display settings section on the Manage display page, then set the body formatter to Summary or trimmed for the Teaser mode.

Related terms

All Drupal terms from A to Z