Template family settings and using the 'Add new' button

Posted 24th Sep 2017

#familysettings #templates

In order to use the 'Add New' button to add new pages to your site, you need to set up a parent/child template relationship.

For example, having a parent page at '/blog/' and a child page at '/blog/a-blog-post'.

Default add new button
Default add new button Zoom

Admin > Setup > Templates

Add a new template called 'blog-index'.

Add a new template
Add a new template Zoom

Do the same for 'blog-entry' so now you have two new templates.

blog-index and blog-entry templates
blog-index and blog-entry templates Zoom

'blog-index' will used for the parent page '/blog/' and 'blog-entry' will be used for pages which are a child of '/blog/' i.e. '/blog/a-blog-post/'.

Click on the 'blog-index' template and navigate to:

Admin > Setup > Templates > Family (tab)

May pages using this template have children: Yes (because blog-entry will be the child pages).

Can this template be used for new pages: One (as this will be the only parent of blog entries).

Allowed template(s) for children: blog-entry (template we will use to create each individual blog entry).

Save this template.

blog-index family settings
blog-index family settings Zoom

Click on the 'blog-entry' template and navigate to:

Admin > Setup > Templates > Family (tab)

May pages using this template have children: No (because blog-entry is the child page).

Can this template be used for new pages: Yes (because you will most likely have multiple posts).

Allowed template(s) for parents: blog-index (template used to create the parent page).

Show in the add-page shortcut menu? Is yes by default (because of this relationship being set up).

Save this template.

blog-entry family settings
blog-entry family settings Zoom

Home (hover) > New

Create a new page as a child of 'Home' called 'Blog' using template 'blog-index'.

Save and publish this page.

Create blog parent page
Create blog parent page Zoom

Go back to the tree view by clicking either 'Pages' tab at the top or 'Admin' link at the top left. Hover over the 'Add New' button.

Add new blog-entry
Add new blog-entry Zoom

But the text might not be what you wanted here. What's displayed is the template 'Label' which you haven't changed yet, so its useing the template 'name'. So let's change that.

Admin > Setup > Templates > Basics (tab)

Change the 'Label' field to 'Blog entry'. This can be whatever you want, it's doesn't need to be the name of the template or anything.

Changing the template label
Changing the template label Zoom

Go back to the tree view, and hover over the 'Add New' button.

Label changed in Add New list
Label changed in Add New list Zoom

Now this is the best bit. Go ahead and click it. You can now create a blog entry without having to choose a template first. The system now knows that the only place a page created with the 'blog-entry' template can go is as a child page of the page created with the 'blog-index' template.

The same applies if you hover over the 'Blog' page in the tree view and select 'New'.

Create new blog entry
Create new blog entry Zoom

Template family settings are really useful if you don't want to keep selecting templates every time you create a page. Just create the relationships as described above and you're all set! It can be used for stuff like a services landing page with a 'services-index' template where the children are the actual services themseleves with a template 'services-entry'.

Experiment, have fun!

Feedback & support

I hope you enjoyed this tutorial. You can support pwtuts by following on @pwtuts. You can also donate at paypal.me/swcarrey to help support the site which would be awesome!

Related tutorials / See all

Suggest a tutorial

Please note: I do not store any of this information, it's simply used to send me an email. Your email address is required so I can get clarification on your request if needed.