Onboarding Build Partner: Building Page Templates

Configure the page templates for your site

The following article applies to partner-led Nyla onboardings, and is published for Onboarding Build Partners.

Once you have completed your section templates and prepared the functionality for your site, the next step is to create page templates for your dynamic pages so that they're as easy to manage as possible.

Decide which pages should have page templates

Page Templates should be used for all dynamic pages (especially those that have a page source), such as collection pages and product pages. 

They ensure that dynamic pages can be managed and updated at scale over time.  

Generally speaking, you should use page templates for your product pages and your collection pages, however you might have additional page templates depending on your needs.

You should use page templates if you have page styles/sections that repeat across multiple pages and should remain the same across all of them.

Confirm requirements

Depending on your needs, you might want page templates to contain logic enabling sections to show or hide based on different factors (e.g product type or a metafield value). 

Tip: To configure section-level visibility based on properties from a page source, you can set your visibility using the page product, page collection or page sources.

Some customers might not have any conditional logic on when sections should appear, however we'd still recommend to use page templates for dynamic pages, so that if you want to add or remove any sections to/from all of your product pages or collection pages, you can do this with one action rather than needing to update your pages one by one. 

Decide on how many page templates you should create

Once you have the requirements for your page template logic, you should then decide how many page templates to create. 

There's no hard and fast rule for this, however we suggest that the fewer page templates you have, the better. Therefore, we'd suggest only to create new page templates for the same page type (e.g 2x product page templates) if you really need to in order to achieve your requirements, or make your page easier to interpret/manage. 

Tip: if you're a Nyla expert preparing page templates for a customer, we recommend to create handover materials explaining the logic of the page templates you create.

Create your page templates

Once you've decided on the page forward, you can create your page templates. 

Tip: If you're adding section visibility logic to section templates at this stage, be careful not to hide them elsewhere on your site.

You might want to leverage properties from page source (as well as page product, page collection) in order to distinguish between collection and product pages for any logic you apply in order to not accidentally hide templates on other pages, or proliferate the same template multiple times.  

Duplicate your PDPs and PLPs using bulk-edit

After you've created your product pages (PDPs) and collection pages (PLPs), you can easily duplicate your page template using bulk edit in order to apply your page templates to all your dynamic pages. 

Test your pages

Once you've created your pages using your page templates, test any logic that you've added to the sections within them in order to ensure everything is working as expected.