Shopify Theme Layout Tutorial
Layouts are Liquid files that allow you to include content, that should be repeated on multiple page types, in a single location. For example, layouts are a good place to include any content you might want in your <head>
element, as well as headers and footers.
Location
Layout files are located in the layout
directory of the theme
└── theme
├── layout
| ├── theme.liquid
| ...
├── templates
...
theme.liquid
must need to contain in shopify theme.
Schema
<!DOCTYPE html>
<html>
<head>
...
{{ content_for_header }}
...
</head>
<body>
...
{{ content_for_layout }}
...
</body>
</html>
content_for_header
-
The
content_for_header
object is required intheme.liquid
. -
It must be placed inside the HTML
<head>
tag. -
It dynamically loads all scripts required by Shopify into the document head.
content_for_layout
-
The
content_for_layout
object dynamically outputs the content for each template. -
You need to add a reference to this object between the
<body>
and</body>
HTML tags.