This feature helps you load a custom template for a particular post page.
- Inside engine/dynamic_content/ create a new postpage file named postpage_section-name-here.xml (Ex: postpage_video.xml).
- Copy the contents of postpage.xml inside your new template and hack away!
Important: The name of the section should be marked as the PRIMARY section of the article when the article is assigned to multiple sections. This is done by going to Dashboard -> Edit Post -> Advanced.
When most of the template is the same as the original postpage.xml, you should consider making use of the <block> XML tag. This will allow you to make use of inheritance and keep your code cleaner and modular.
Start by creating a block inside your original postpage.xml file:
<block name="body"> <!-- Code placed here will be available on all postpages --> <!-- Create a new placeholder block you want to use --> <block name="custom_block_name"> <!-- Code placed here will be overwritten with code in postpage_section-name-here.xml --> </block> <!-- Code placed here will be available on all postpages --></block>
Then in your new template postpage_section-name-here.xml add this code:
<import_xml path="postpage.xml"> <!-- Inherit postpage.xml markup --> <!-- This will override the same block in postpage.xml --> <block name="custom_block_name"> <div> <!-- Code placed here will be available only on postpage_section-name-here.xml --> </div> </block></import_xml>
Note: You can use any name for your blocks tag, just change name="custom_block_name" to your liking. Make sure you use the same block name across all your postpage templates.