Static vs. Dynamic Sections

New Member
1 0 0

Short version: Is there a way to accomplish duplicate content between the home-page and another content page without having to define two identical section files (one dynamic and the other static)? 

----

Longer version: I'm currently building a site that features a homepage as well as a "product" page. The product page mirrors alot of the homepage content. Similar to how petnet features repeated sections between their homepage [0] and another product page [1].

To include the content in the homepage of my theme (jumpstart), I'm using dynamic sections with presets defined in the schema (so I'm not even using the left side editor to control the content, just the order of the items). To include it in my product page, I can't use the dynamic section, and have to use a static section with defaults defined. This results in me having totally identical section files, except one that has "presets" defined while the other has "default" defined [2].

Is there another way to accomplish this without having to have two identical files that differ by 1-2 lines? 

This is a huge pain and seems like a pretty big design flaw - why limit a section to be either dynamic or static? Why not let dynamic sections be included in other sections, and just automatically use the "presets" values? I could just edit the index template and include my section statically, but then I'd either have to use the section before every other section or after every other section. 

Thanks in advance. 

[0] www.petnet.io

[1] www.petnet.io/smartbowl

[2] https://help.shopify.com/themes/development/theme-editor/sections

0 Likes
Shopify Partner
1 0 0

This article talks about (the problem, with a few solutions) in depth: https://ecommerce.shopify.com/c/ecommerce-design/t/sections-blocks-per-page-382552

0 Likes
Shopify Partner
1346 22 208

On the homepage do not include the section via the theme settings.

Add it directly to the index.liquid markup with {% include 'section-foo' %}

Do the same thing on other templates and the settings will be commune.

https://sections.design tips, tricks & Shopify sections
0 Likes
Tourist
4 0 1

I used the approach I explained here: https://medium.com/@lasserosendahlravn/advanced-shopify-building-dynamic-sections-on-custom-pages-8c...

 

Hope that could work for you too. If not the entire content then maybe the approach I took :)

0 Likes
Excursionist
20 1 1

Rosrav,

 

How do you go about a section that already got blocks in it?

Because from what I understand you can't define a block within a block.

0 Likes