My dynamic section isn't appearing

Highlighted
Shopify Expert
11 0 0

When I go to "Customize Theme", it says "This page doesn't have sections."

 

I am viewing the home page. I have created a new liquid file in the sections folder with the following code. I have searched and searched but for the life of me I can figure out why this isn't appearing as a dynamic section in the Customize Theme menu. Can anyone help please?

 

<div id="section-cta">
  <h3>{{ section.settings.text-box }}</h3>
  <a href="{{ section.settings.link }}">{{ section.settings.linktext }}</a>
</div>


{% schema %}
  {
    "name": "Call to action",
    "settings": [
	{
		"id": "text-box",
		"type": "text",
		"label": "Heading",
		"default": "Title"
	},
	{
		"id": "link",
		"type": "url",
		"label": "Button link"
	},
	{
		"id": "linktext",
		"type": "text",
		"label": "Button text",
		"default": "Click here"
	}
]
,
  "presets": [
      {
          "name": "Call To Action",
          "category": "Call To Action"
      }
  ]
  }
{% endschema %}

{% stylesheet %}
{% endstylesheet %}

{% javascript %}
{% endjavascript %}
0 Likes
Highlighted
Shopify Partner
1445 195 521

Im gonna guess it's because your presets come at the end, change them to the beginning:

 

https://help.shopify.com/en/themes/development/sections#presets

 

I would just copy and paste that, see if it works, then adjust it to what you already have.

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
Highlighted
Shopify Expert
11 0 0

Unfortunately neither solution works. I have also tried copying dynamic sections from other themes and they don't work either. Is there another place within my theme that I need to define it as being a "section based theme"?

 

Here is the new code, with no difference:

 

  <div id="section-cta">
    <h3>{{ section.settings.text-box }}</h3>
    <a href="{{ section.settings.link }}">{{ section.settings.linktext }}</a>
  </div>


  {% schema %}
    {

    "presets": [
        {
            "name": "Call To Action",
            "category": "Call To Action"
        }
      ],
  	  "name": "Call to action",
      "settings": [
      {
          "id": "text-box",
          "type": "text",
          "label": "Heading",
          "default": "Title"
      },
      {
          "id": "link",
          "type": "url",
          "label": "Button link"
      },
      {
          "id": "linktext",
          "type": "text",
          "label": "Button text",
          "default": "Click here"
      }
  ]
    }
  {% endschema %}

  {% stylesheet %}
  {% endstylesheet %}

  {% javascript %}
  {% endjavascript %}
0 Likes
Highlighted
Shopify Partner
2 0 5

Hi @Dan_Wiseman1 

Don't forget to add {{content_for_index}} in your template/index.liquid

Highlighted

I'm having this same issue. 

Yes, {{content_for_index}} was added. 

Yes, I validated my JSON. 

“If we can really understand the problem, the answer will come out of it, because the answer is not separate from the problem. ” ― Jiddu Krishnamurti
0 Likes