h1. How do I show only an excerpt in article lists? [todo]
Textpattern provides two main text fields per article: the Body and the Excerpt. The Body is the main article content. The Excerpt is normally used for a summary, introductory paragraph, abstract or similar.
To implement a “Read More” link, we’ll display the Excerpt on list pages (such as the front page and section pages), and the Body on the individual article (‘permlink’) pages. There are two ways to do this: one by using separate forms for the list and article pages; and another by using a single article form with a @
Use two article forms: one that shows only the excerpt, and one that shows the full article. Your main article form (typically ‘default’) would normally contain a @
Create a new article form named “excerpt”, containing something like this:
Your default form normally contains something like this (edited for brevity):
In your page template, use @@.
This means that the default form will be used for full article pages, and the excerpt form will be used for list pages. To change the appearance of either page (e.g. to remove the excerpt from the full article page), edit the appropriate form.
(For more information the article tag and forms, see “‘How do I select which form is used to display articles?’“:http://textpattern.com/faq/22/how-do-i-select-which-form-is-used-to-display-articles)
Use an article form, containing something like this:
If you want to include the excerpt as well as the body on the article page, just add a @
With either of the above methods, you can use the @
The same “txp:if_excerpt”:http://textbook.textpattern.net/wiki/index.php?title=if_excerpt tag can be used on the list page to handle articles that have no Excerpt set. For example, to display the article Body when the Excerpt is empty:
If you need to automatically generate an Excerpt from the Body, there are several plugins that will help. You’ll find them at “Textpattern Resources”:http://textpattern.org/ or on the “Textpattern Plugins Forum”:https://forum.textpattern.com/viewforum.php?id=13.