Skip to content

Instantly share code, notes, and snippets.

@keirwhitaker
Created July 11, 2017 09:25
Show Gist options
  • Save keirwhitaker/b3f7a33d1b18ff7f9fb90217f3b112e6 to your computer and use it in GitHub Desktop.
Save keirwhitaker/b3f7a33d1b18ff7f9fb90217f3b112e6 to your computer and use it in GitHub Desktop.
A dynamic sections template
{% for block in section.blocks %}
{% if block.type == "promo-box" %}
<h3>{{ block.settings.title }}</h3>
<p>{{ block.settings.description }}</p>
{% elsif block.type == "image-picker" %}
<img src="{{ block.settings.promo-image | img_url: '800x' }}" />
{% endif %}
{% endfor %}
{% schema %}
{
"name": "Promotional Blocks",
"max_blocks": 5,
"presets": [
{
"name": "Promotional Blocks",
"category": "Custom Homepage Content"
}
],
"blocks": [
{
"type": "promo-box",
"name": "Promotional Box",
"limit": 1,
"settings": [
{
"id": "title",
"type": "text",
"label": "Title",
"default": "your title here"
},
{
"id": "description",
"type": "textarea",
"label": "Description",
"default": "your description here"
}
]
},
{
"type": "image-picker",
"name": "Promo Image",
"settings": [
{
"id": "promo-image",
"type": "image_picker",
"label": "Promo Image"
}
]
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment