Tip: Creating excerpts using words and chars
Using the chars
attribute tells the template engine to only show that number of characters when rendering the field:
<perch:content type="text" id="heading" label="Heading" chars="100" />
The words
attribute has the same effect, this time restricting the number of words:
<perch:content type="text" id="heading" label="Heading" words="20" />
This can be very useful if you are creating a list/detail page setup using perch_content_custom()
as described in this solution.
If you wanted to show an excerpt of your article on the listing page, limited to 30 words, you could use the following:
<perch:content id="body" type="textarea" label="Body"
required="true" words="30" />
There is information about words and chars in the Perch documentation.