Section blocks - not displaying

Highlighted
Tourist
13 0 1

Hello. I'm working on custom theme. I have a problem with this section, which isn't showing up in theme editor:

Is there any mistake in this one?

{% for block in section.blocks %}

    <div class="slider">
        <div class="cta">
            <img class="cta__image" src="{{ block.settings.image | img_url: '2048x' }}" alt="Tackma">
            <div class="cta__info">
                <strong class="cta__title">{{ block.settings.title }}</strong>
                <a class="cta__link" href="{{ block.settings.link }}">Shop now</a>
            </div>
        </div>
    </div>

{% endfor %}

{% schema %}
{
    "name": "CTA",
    "class": "cta",
    "blocks": [
        {
            "type": "cta",
            "name": "CTA",
            "settings": [
                {
                    "id": "title",
                    "type": "text",
                    "label": "Title"
                },
                {
                    "id": "link",
                    "type": "url",
                    "label": "Link"
                },
                {
                    "id": "image",
                    "type": "image_picker",
                    "label": "Image"
                }
            ]
        }
    ],
    "presets": [{
        "name": "Call To Actions",
        "category": "Custom"
    }]
}
{% endschema %}

{% stylesheet %}
{% endstylesheet %}

{% javascript %}
{% endjavascript %}

 

0 Likes
Highlighted
Excursionist
47 0 5

Hi Kacper,

I've tested in a demo shop and the section works fine for me and shows up in the theme editor.

Are you sure your file is located in the Sections folder?

With a passion for e-commerce!
0 Likes
Highlighted
Tourist
13 0 1

Thank you very much. Indeed, the problem was not in this section, but inside index.liquid. There was {% content_for_index %} while i should have used double brackets syntax. It fixed the problem. 

We can now close the topic. 

Best regards, K.

 

0 Likes
Highlighted
New Member
2 0 1

EDIT: I solved it, for those who are still stuck here is what did the trick for me: I am using Theme Kit to edit my theme and I created this new section under the sections folder. When I double checked the file from the built in code editor in Shopify I realised it was there but empty. I just did a copy paste of my file from my local code editor and could see the updates I made afterwards.

 

N.B. I only had to do the copy paste once. My changes were automatically updated using Theme Kit afterwards.

 

Hi,

 

I have the same issue with a custom section I built but doesn't appear on the theme editor. My index.liquid has {{ content_for_index }} and my section file is in the Sections folder. Anyone knows what the issue is?

 

Here is my schema below.

 

Thanks!

 

{% schema %}
{
  "name": "Services",
  "max_blocks": 6,
  "settings": [
    {
      "id": "section-title",
      "label": "Section Title",
      "type": "text",
      "default": "Services"
    },
    {
      "id": "bg-img",
      "label": "Background image",
      "type": "image_picker"
    }
  ],
  "presets": [
    {
      "name": "Services List",
      "category": "Custom Sections"
    }
  ],
  "blocks": [
    {
      "type": "select",
      "name": "Service",
      "settings": [
        {
          "id": "service-title",
          "label": "Service Title",
          "type": "text",
          "default": "Guiding"
        },
        {
          "id": "service-desc",
          "label": "Service Description",
          "type": "text",
          "default": "Welcome to the jungle!"
        },
        {
          "id": "service-icon",
          "label": "Font Awesome icon class",
          "type": "text",
          "default": "fas fa-tree"
        }
      ]
    }
  ]
}
{% endschema %}

 

1 Like
Highlighted
New Member
1 0 0

Thank you SO much for posting your solution, Karim! This fixed mine too

0 Likes