A space to discuss online store customization, theme development, and Liquid templating.
Hi I'm creating a new theme for a customer. And for some reason I can't add sections to home page. There is no template assigned. If I go to collection page there is not issue at all, I can add all the sections available. If I look at my templates in Edit code there is an index.json that is an empty json object with sections and order as it should be since I can't add anything. And in my theme.liquid I use the standard {{ content_for_layout }} between main tag. Have anyone else encountered the same issue?
Regards
Joakim
Hello there
In your Shopify admin panel, go to "Online Store" > "Themes" and click on "Customize" for the theme you're working on.
Click on "Add section" and see if any sections are available to add to the homepage. If there are no sections available, then the issue may be related to the homepage template.
Go back to the main "Themes" screen and click on "Actions" > "Edit code" for the theme you're working on.
In the file list, look for a file named "templates/index.liquid". This is the template that should be assigned to the homepage. If this file is missing, then you will need to create it.
Open the "index.liquid" file and add the necessary code to render the sections. The code should look something like this:
{% section 'featured-collection' %}
{% section 'image-with-text' %}
{% section 'product-list' %}
In this example, the code is calling three sections: "featured-collection", "image-with-text", and "product-list". Replace these with the section names that you want to include on your homepage.
If this fixed your issue, likes and accepting as a solution are highly appreciated
| Build an online presence with our custom-built Shopify Theme: EcomifyTheme
| Check out our reviews: Trustpilot Reviews
| We are Shopify Partners: EcomGraduates Shopify Partner
Great explanation, it helped me solve a similar problem. Thank you!
Thanks for the answer. So does this mean that index.json needs a default section like other templates, i.e. collection ({ main: main-collection})? Index doesn't seem have that, only sections and order. And other sections should get a generated ID. I get that you can remove the "hard-coded" section afterwards. But I would like to know what the best practice is.