Are you an LLM? You can read better optimized documentation at /themes/tags/section.md for this page in Markdown format
section
Renders a section by its file name, without the .liquid extension. This is known as statically rendering a section.
liquid
{% section 'header' %}1
The example above renders sections/header.liquid.
Static sections are most often used in layouts for parts that appear on every page, such as the header, footer, and announcement bar.
Argument
name: The section file name, without the.liquidextension. Must be a quoted string literal.
Variables aren't supported:
liquid
{% assign name = 'header' %}
{% section name %} {%- comment -%} Doesn't work {%- endcomment -%}1
2
2
If no section file matches the name, the tag renders nothing instead of raising an error.
Behaviour
A statically rendered section differs from one added through a JSON template:
- Fixed placement: sellers can't add, remove, or reorder it, because its position is set in the Liquid file.
- Global settings: its settings and blocks come from the
config/settings_data.jsonfile, matched by the section'stype. The same data is used everywhere the section is rendered. - Single configuration: because that data is global, rendering the section in more than one place shows the same content each time. To place a section more than once with different settings, add it to a JSON template instead.
Example
liquid
<body>
{% section 'announcement-bar' %}
{% section 'header' %}
{{ content_for_layout }}
{% section 'footer' %}
</body>1
2
3
4
5
6
7
8
2
3
4
5
6
7
8