This document details how you can reuse code across multiple pages using partials. Partials are pieces of code extracted to their own separate files to maintain code readability and follow the rule of DRY – Don’t Repeat Yourself.
You can create and manage partials using the Instance Admin. Please visit our Instance Admin documentation on Partials for more details.
To follow the steps in this tutorial, create a page and a layout:
Reusing code across multiple pages using partials is a two-step process:
This tutorial uses the previously created
Create a partial file
In the original layout, include the
Deploy or sync your changes. Pages using the layout are displayed the same. When you check their source code, you can learn that the meta tags have been injected into the layout and, thus, the pages from the partial.
You can use partials with CSS, Javascript, etc. or include
Congratulations! You have reused code across multiple pages using partials. Now you can learn about using assets: Using Static Assets on Your Pages
Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.