Hi,
is it possible to use Schema tag in a snippet (.liquid) file (theme directory /snippets)?
When I use this, the theme Kit returns an error: (snippets/include-icons-text.liquid) Liquid syntax error (line 1): Unknown tag ‘schema’
Hi,
is it possible to use Schema tag in a snippet (.liquid) file (theme directory /snippets)?
When I use this, the theme Kit returns an error: (snippets/include-icons-text.liquid) Liquid syntax error (line 1): Unknown tag ‘schema’
In snippet, you cant use schema tags. You need to use a schema in the section and include snippets in that section. So you can use both and apply schema in the snippet.
like below
{% include ‘social-sharing’ %}
{% schema %}
{
“name”: “Posts”,
“settings”: [
{
“type”: “text”,
“id”: “heading_title”,
“label”: “Heading”,
“default”: “News Detail”
},
…
{% endschema %}
Hi @Biterscode
Thank you for your answer. I want to duplicate this section for other products (like 10 others). So If there is a change in the schema tag, I have to edit all the 10 sections. Therefore I want it modular so I have to change it once. Any possible alternative ideas?
To reduce repeat you can use conditional structure. The use of Snippet is to reduce duplication. So ex if you want to show the price in one product and not for another then you can use the same section and snippet with the condition or you can male scheme for enabling and disabling that price. So you don’t have to make 10 sections or snippets.