Skip to content

Layouts

A layout is the HTML around every page: <html>, <head>, the header and footer. Templates use layout/theme.liquid unless they choose another.

layout/theme.liquid
<!doctype html>
<html lang="{{ request.locale.iso_code }}" dir="{{ request.locale.direction }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ page_title }}{% unless page_title == shop.name %} – {{ shop.name }}{% endunless %}</title>
{%- if page_description != blank %}<meta name="description" content="{{ page_description }}">{% endif %}
<link rel="canonical" href="{{ canonical_url }}">
{{ 'base.css' | asset_url | stylesheet_tag }}
{{ content_for_header }}
</head>
<body class="template-{{ template.name | handle }}">
{% sections 'header-group' %}
<main id="MainContent">{{ content_for_layout }}</main>
{% sections 'footer-group' %}
</body>
</html>
Object Where What it adds
content_for_header inside <head> hreflang links, robots meta on previews, analytics and pixels (after consent), the visual editor bridge
content_for_layout inside <body> the template’s sections

Set dir from request.locale.direction so the page flips for Arabic. See RTL and Arabic typography.

  • A JSON template: "layout": "landing" uses layout/landing.liquid; "layout": false renders without one.
  • A Liquid template: {% layout 'landing' %} or {% layout none %}.
  • A custom page: "layout" in its schema ("theme" by default, "none" for a bare page).
  • The password page uses layout/password.liquid when the theme has it.

Was this page helpful?