Community Documentation

Manually controlling the teaser break point

Last updated January 29, 2011. Created by jbrauer on September 19, 2007.
Edited by sillygwailo, add1sun, Michelle, VM. Log in to edit this page.

Drupal has several ways of displaying nodes, e.g., Page view and Teaser view. In Page view Drupal displays the whole node, whereas in the Teaser view, only the Title and the Teaser are visible.

The teaser contains the first part of the body. By default Drupal's settings control where break between the teaser and the rest of the node occurs. It is possible, however, to set this manually using a special HTML comment tag.

Teaser settings (configured in Post settings) are global for all content created after the value is set. To change the teaser length of existing content, each node must be re-saved for the change to be reflected.

In order to manually set where the point for the teaser and remainder of the body to be split in a post, insert the tag <!--break--> where the teaser should end. Everything before this tag will appear in the teaser.

Note

Make sure there are no spaces in the tag or it will be ignored.

HTML block and span elements should not be divided by the <!--break--> tag as this may cause problems with the page layout and will produce invalid HTML markup. For this reason while the tag can be placed in the middle of a paragraph it is not advisable. The full text will not notice the tag so the paragraph will look normal, but the paragraph will be cut short in the teaser.

To prevent the block and span elements from being left open in the teaser display in Drupal 5.x using the contributed HTML corrector module can automatically close the tags. (In Drupal 6.x, this is part of Drupal core and is enabled by default.)

Comments

Solution for non-gurus?

Hi,

This is nice and I use it often, but is there any way to achieve this for a non-guru? Perhaps one of the WYSIWYG editors includes a shortcut button for this? I'm the webmaster for a Drupal site and I've been trying to hand it off to the beneficiary for two years, but dozens of little quirks like this prevent us from making the transition. I can tell them "click the «edit HTML» button, read through the HTML tags until you find the text you are trying to break, then type in these cryptic hieroglyphs", but they aren't experts and issues like this discourage them.

Thanks,
Catalin

I have noticed that

I have noticed that TinyMCE/Wysiwyg has the option of a "teaser break" button, but I haven't tested it myself.

Deniz Dogan

Yes, TinyMCE has Teaser break

Yes, TinyMCE has Teaser break button you can enable

CK Editor too...

The CK WYSWYG editor (http://drupal.org/project/ckeditor) also has a toolbar icon to automatically insert the "teaser" markup into the node body field muck like TinyMCE. Also consider using the general WYSIWYG module (http://drupal.org/project/wysiwyg) to get a WYSWYG editor into your site as well.

layout problem

For drupal 7 the page layout goes wrong when i put teaser break manually (using ckeditor).but this happens only with the zeropoint theme.

In order to get these manual

In order to get these manual break points working, which format do you choose from the dropdown for teaser > body under Manage display? Please...thank you :)

Unfortunately I cannot edit

Unfortunately I cannot edit this page :/ so I have to post a comment.

In D7 the gets stripped out by the "Filtered HTML" Textformat. Adding HTML comment to the allowed tags, helps.

See this issue as well: http://drupal.org/node/881006#comment-5102160

--

keine zeit für spielkonsolen mein leben ist jump n run!

valderama.net

About this page

Drupal version
Drupal 5.x, Drupal 6.x, Drupal 7.x
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.