你结合了settings_schema.json 和{% schema %} 部分的逻辑,这是一个“不不”。
这就是标准settings_schema.json 的样子:
[
{
"name": "theme_info",
"theme_name": "Theme",
"theme_author": "N/A",
"theme_version": "1.0.0",
"theme_documentation_url": "https://help.shopify.com/manual/using-themes",
"theme_support_email": "theme-support@shopify.com"
},
{
"name": "General",
"settings": [
{
"type": "header",
"content": "Favicon"
},
{
"type": "image_picker",
"id": "favicon",
"label": "Favicon"
}
]
},
{
"name": "Social media",
"settings": [
{
"type": "header",
"content": "Social sharing image"
},
{
"type": "image_picker",
"id": "share_image",
"label": "Image"
}
]
},
{
"name": "Footer",
"settings": [
{
"type": "richtext",
"id": "copyright",
"label": "Copyright",
"info": "Use [year] to set the current year."
}
]
}
]
这就是{% schema %} 部分的外观。
{% schema %}
{
"name": "Slideshow",
"settings": [
{
"id": "header",
"type": "text",
"label": "Header",
"default": "Hello world"
},
{
"id": "content",
"type": "textarea",
"label": "Content"
}
],
"blocks": [
{
"type": "quote",
"name": "Quote",
"settings": [
{
"id": "content",
"type": "text",
"label": "Quote"
},
{
"id": "title",
"type": "text",
"label": "Title"
}
]
}
]
}
{% endschema %}
所以总结一下,你需要了解settings_schema.json 语法和{% schema %} 部分语法之间的区别。
目前我不确定您是在settings_schema.json 中做出选择,还是在单独的部分中做出选择。在这两种情况下,您都需要修复架构语法。
如果您使用的是 settings_schema.json,则 json 周围没有 {% schema %}。
如果您使用的是{% schema %} 部分,您只能使用一个对象(如果它不是块):
{
"name": "Main Menu",
"settings": [
.....
]
}
阅读部分文档:https://help.shopify.com/en/themes/development/sections
还有 settings_schema 文档:https://help.shopify.com/en/themes/development/theme-editor/settings-schema