As with Perch content the blog uses templates. The default templates are stored inside the
perch_blog/templates folder however you should not edit these directly.
To modify templates copy the templates from
/perch/templates/blog and then make your changes. If a template has the same name in this folder as the template in the
perch_blog folder it will be used rather than the default. You can also create your own templates with any name you like and pass in the name of the template when using
The master template for a blog post is
post.html. You can add alternative post templates by placing the in the
Blog exposes the following variables for use in the ID attributes of
For example to display the blog title in your template use:
<perch:blog id="postTitle" />
Adding additional fields
As with Perch Content Templates you can add your own fields to the master blog template and they will appear in the admin to be completed by the user.
The master template for blog is post.html so any fields you want to be available in the admin for administrators to complete must appear in this template.
You can use any perch:content tags within blog templates however instead of starting the field with perch:content you must start it with perch:blog.
Adding fields to use in other templates
By default any field you add to the post.html template will appear on the page. If you just want to add a field so that it appears in admin and may be used by another template then add the variable
suppress="true" to the field. It will then appear in admin to be completed by the user but not display when post.html is used.
The excerpt in the default post.html is a good example of this. The below creates a field that does not display when post.html is used but is used instead on post_in_list.html.
<perch:blog id="excerpt" type="textarea" label="Excerpt" editor="markitup" textile="true" order="1" suppress="true" size="m" />