shopify - Change the directory of sections
Change the directory of sections I've been searching for a while now to find a solution on how I can possibly create a new folder within my 'Sections' folder, and have these sections included in my template files. I Have been trying this for my self, but end up with the following error: 'Liquid error: Error in tag 'section' - 'folder/section-filename' is not a valid section type'. Which means it can not find the linked file.
The reason I would like to create subfolders in the 'Sections' folder is because when you want to have sections on any other custom page than the homepage, you have to 'duplicate' the section, and include this in the custom created template file. Which means; When, for example, I want to have 6 sections on 1 page I need to create 6 section-files. If I want to have another custom page with 6 sections, I end up with 12(6+6) sections already, and so on it goes. Quite messy.
Any other possible solutions/ideas on how to get things like this more 'organized' will be very welcome.
I hope I made my problem clear, thanks in advance for any help!
Cannot help you with a superior pattern of use, but to answer to your main point: You cannot make subfolders. You place files in files/ or sections/ or assets/ or snippets/ but you cannot further subdivide.
So while you may decry this as a outrage to your sensibilities, coming from some other looser platform(s) rules... that is the way it is. If you have to be a little repetitive and long-winded, too bad. You can always try and reduce clutter with strategic DRY setups. Practice makes it easier.
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.