I would like to have alternative templates for each section of my website.
How do you set up a page to use a different template in Zotonic?
I would like to have alternative templates for each section of my website.
How do you set up a page to use a different template in Zotonic?
Hi Alain,
Here is how you could render the about page with a custom template:
{about, ["about"], resource_page, [ {template, "about.tpl"}, {id, page_about}]}
If you add the above dispatch rule to your site's dispatch rules (found at yoursite/dispatch/dispatch) it will render a page with the unique name of page_about using about.tpl.
You can set the unique name for a page in the advanced tab of the page in the zotonic admin.
Good practice is to set the page_path
property to the url you define in the dispatch rule. So that the page_url of the (in the example) page_about is also "/about".