Perch documentation

Template tags

When a new editable region is identified, the first step of editing is to choose a template. The template is an HTML file that represents the final output that Perch will insert into your pages. Perch defines a number of template tags that act as placeholders for content. The content editing page will present a form field of each of these placeholders.

This may be easiest to see through an example.

<h2>
    <perch:content id="heading"type="text"label="Heading"/>
</h2>

<p class="date">
    <perch:content id="date"type="date"label="Date"/>
</p>

<perch:content id="body"type="textarea"label="Body"/>

This is a template for a simple article that has three elements to it – a heading, a date and the body of the story. When editing content that uses this template, the user will be presented with three edit fields – a simple text field for the heading, a date picker for the date and a textarea for the article body.

NB: The <perch:content/> tags are of course replaced by the published content, so no custom tags appear in the final page.