Ошибки: неверный JSON в теге "схема" (Shopify Slick Sider)
Я создаю скользкий слайдер, используя новую функцию раздела Shopify. Все, что нужно, это добавить изображение со стрелкой влево и вправо.
С помощью заголовка, описания и кнопки пользователь может изменить и добавить ссылку на все, что находится в верхней части карусели, и изменить все, что нужно, щелкнув по кнопке со стрелкой или призрачными кнопками внизу.
Вот скриншот.
{% if section.blocks.size > 0 %}
<!-- Slick Slider Wrapper -->
<div class="carousel-wrapper" style="background-color: red;">
<div class="carousel-info">
<!-- Title Slider Wrapper -->
<h3>{{ section.settings.carousel_title }}</h3>
<!-- Description Wrapper -->
<p>{{ section.settings.carousel_product_description }}</p>
<!-- Button Wrapper -->
<button>{{ section.settings.carousel_button_title }}</button>
</div>
<!-- Slick Slider -->
<div id="carousel-{{ section.id }}" class="carousel" data-slick='{"autoplay": {{ section.settings.carousel_autoplay }}}'>
{% for block in section.blocks %}
<div class="carousel-slide--{{ block.id }}" {{ block.shopify_attributes }} style="width:240px">
{% if block.settings.carousel_image != blank %}
<img class="carousel_image--{{ block.id }}" src="{{ block.settings.carousel_image | img_url: '240x' }}" style="max-width:240px;display:inline-block;padding:40px">
{% endif %}
</div>
{% endfor %}
</div>
<!-- ended of Slick Slider -->
</div>
</div>
{% endif %}
{% if section.blocks.size == 0 %}
<div class="placeholder-noblocks">
{{ 'homepage.onboarding.no_content' | t }}
</div>
{% endif %}
<!-- Slick Slider Wrapper -->
{% schema %}
{
"name": "Carousel",
"max_blocks": 8,
"settings": [
{
"type":"header",
"content":"Carousel option"
},
{
"type":"text",
"id":"carousel_title",
"label":"Carousel title",
"default":"Carousel main title"
},
"type": "text",
"id": "carousel_title",
"label":"Carousel title",
"default":"Carousel main title"
},
{
"type" "text",
"id": "carousel_product_description",
"label": "Carousel Description",
"default: Carousel Main Description"
},
{
"type": "url",
"id": "carousel_link",
"label": "Carousel title link"
},
{
"type":"header",
"content":"In depth carousel option"
},
{
"type": "checkbox",
"id": "carousel_autoplay",
"label": "Auto-rotate slides",
"default": false
},
{
"type":"color",
"id":"carousel_bg",
"label":"Carousel background",
"default":"#fff"
}
],
"blocks": [
{
"type": "image",
"name": "Image slide",
"settings": [
{
"type": "image_picker",
"id": "carousel_image",
"label": "Image"
},
{
"type": "url",
"id": "slide_link",
"label": "Slide link"
}
]
}
],
"presets": [{
"name": "Carousel",
"category": "Image",
"settings": {
"carousel_autoplay": false
},
"blocks": [
{
"type": "image"
},
{
"type": "image"
},
{
"type": "image"
},
{
"type": "image"
},
{
"type": "image"
},
{
"type": "image"
}
]
}]
}
{% endschema %}
1 ответ
Вы пропустили открытую фигурную скобку перед типом слова и двоеточие после объекта второго типа.
{
"name": "Carousel",
"max_blocks": 8,
"settings": [
{
"type":"header",
"content":"Carousel option"
},
{
"type":"text",
"id":"carousel_title",
"label":"Carousel title",
"default":"Carousel main title"
},
{
"type": "text",
"id": "carousel_title",
"label":"Carousel title",
"default":"Carousel main title"
},
{
"type": "text",
"id": "carousel_product_description",
"label": "Carousel Description",
"default: Carousel Main Description"
},
{
"type": "url",
"id": "carousel_link",
"label": "Carousel title link"
},
{
"type":"header",
"content":"In depth carousel option"
},
{
"type": "checkbox",
"id": "carousel_autoplay",
"label": "Auto-rotate slides",
"default": false
},
{
"type":"color",
"id":"carousel_bg",
"label":"Carousel background",
"default":"#fff"
}
],
"blocks": [
{
"type": "image",
"name": "Image slide",
"settings": [
{
"type": "image_picker",
"id": "carousel_image",
"label": "Image"
},
{
"type": "url",
"id": "slide_link",
"label": "Slide link"
}
]
}
],
"presets": [{
"name": "Carousel",
"category": "Image",
"settings": {
"carousel_autoplay": false
},
"blocks": [
{
"type": "image"
},
{
"type": "image"
},
{
"type": "image"
},
{
"type": "image"
},
{
"type": "image"
},
{
"type": "image"
}
]
}]
}