Themes 加上「;积木;在';settings_schema.json';在shopify主题中
我是Shopify新手,在Shopify中构建我的自定义主题我想在设置中添加“块”_schema.json,因为我在schema部分添加了“块”,这可能吗?如果是,我如何添加它?请帮帮我Themes 加上「;积木;在';settings_schema.json';在shopify主题中,themes,shopify,Themes,Shopify,我是Shopify新手,在Shopify中构建我的自定义主题我想在设置中添加“块”_schema.json,因为我在schema部分添加了“块”,这可能吗?如果是,我如何添加它?请帮帮我 我添加了以下代码: [ { "name": "theme_info", "theme_name": "Slate", "theme_version": "0.11.0", "theme_author": "Shopify", "theme_documentat
我添加了以下代码:
[
{
"name": "theme_info",
"theme_name": "Slate",
"theme_version": "0.11.0",
"theme_author": "Shopify",
"theme_documentation_url": "https:\/\/shopify.github.io\/slate\/",
"theme_support_url": "https:\/\/github.com\/Shopify\/slate"
},
{
"name": "Colors",
"settings": [
{
"type": "header",
"content": "General colors"
},
{
"type": "color",
"id": "color_theme",
"label": "Theme color",
"default": "#efeeeb",
"info": "Used for theme"
},
{
"type": "color",
"id": "color_primary",
"label": "Primary color",
"default": "#4d4d4d",
"info": "Used for text links, and primary buttons"
}
],
"blocks": [
{
"type": "product_colors",
"name": "Product colors",
"settings": [
{
"type": "color",
"id": "color_label",
"label": "Color label",
"default": "red"
},
{
"type": "color",
"id": "color_code",
"label": "Color code",
"default": "#ff0000"
}
]
}
]
}
]
但它给出了一个错误:
错误:第2节:“块”不是有效的属性
设置\u schema.json
文件中不支持任何其他解决方案
块仅在{%schema%}{%endschema%}
标记内的节文件中受支持
你的问题有一些解决办法
使用链接列表
如果必须使用settings\u schema.json
,则可以使用link\u list
字段选择特定的link\u列表,在该列表中可以创建一个导航,其中颜色标签作为链接标题,十六进制代码作为链接url地址
使用seprate部分
对颜色使用单独的部分,您可以在其中选择块
使用文本区域
你可以使用一个文本区域,只需稍微拆分一下,就可以得到你想要的效果
例如,textarea的值将为:
Black|#000000
White|#ffffff
Grey|#cccccc
您将执行以下操作:
{% assign textarea = settings.textarea | newline_to_br | split: '<br /> %}
{% for text_row in textarea %}
{% assign text_row_array = text_row | split: '|" %}
{% assign color_name = text_row_array[0] %}
{% assign color_hex = text_row_array[1] %}
...
{% endfor %}
{%assign textarea=settings.textarea | newline | to _br | split:'
%}
{textarea%}中的text_行为%
{%assign text_row_array=text_row|split:'|“%}
{%assign color\u name=text\u row\u array[0]}
{%assign color\u hex=text\u row\u array[1]}
...
{%endfor%}
总结
最方便用户的选项是区段选项,但您可以决定最适合您的需要。非常感谢@drip这些解决方案解决了我的问题