A Layout is a Liquid view that stores repetitive code. Examples of page elements that are good candidates for putting into a Layout are static elements that surround page content, such as sidebars, headers, and footers.
Without the layout, every page would need to share many duplicated codes. This arrangement makes updates and bug fixes very time-consuming and error-prone.
Using layouts, you can extract the common elements of many pages in one place. Usually, the layout is the very first thing you want to develop.
All layouts should be located in the
At a minimum, the content of the layout should look like this:
This layout only renders the page's content and is equivalent to passing
The most common use case of layouts is to place something before and after the content of the page:
If you want layouts for your non-HTML pages, put
Examples:
In the page
The most important part of every layout file is the
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.