A space to discuss online store customization, theme development, and Liquid templating.
Hey,
I'm trying to have some premade blocks within my theme when I open the customizer, just like the standard logo banner or gallery section from the Dawn theme.
The problem is that it just won't work even when I setup everything correctly in my schema presets. I've also tried it with a completely new section and on another theme (ride) but it still won't work.
Everytime I serve my theme to continue developing I have to manually add all the blocks in every single section and that's really, really annoying.
Does anybody know something about that? I'd be incredibly happy about some help..
The code below is from someone on the discord server that tried to help me. I've also setup a section in my theme to try it out myself and it still didn't work - it worked for him tho.
<section class="section section-{{ section.id }}" data-section-id="{{ section.id }}" data-section-type="list">
{%- if section.settings.title != blank -%}
<h2>{{ section.settings.title | escape }}</h2>
{%- endif -%}
{%- if section.blocks.size > 0 -%}
<ul>
{%- for block in section.blocks -%}
{%- if block.settings.text != blank -%}
<li>{{ block.settings.text | escape }}</li>
{%- endif -%}
{%- endfor -%}
</ul>
{%- endif -%}
</section>
{% schema %}
{
"name": "Simple List",
"settings": [
{
"type": "text",
"id": "title",
"label": "Heading"
}
],
"blocks": [
{
"type": "item",
"name": "List item",
"settings": [
{
"type": "text",
"id": "text",
"label": "Text"
}
]
}
],
"presets": [
{
"name": "Simple List",
"settings": {
"title": "My List"
},
"blocks": [
{
"type": "item",
"settings": {
"text": "Item 1"
}
},
{
"type": "item",
"settings": {
"text": "Item 2"
}
},
{
"type": "item",
"settings": {
"text": "Item 3"
}
}
]
}
]
}
{% endschema %}