0
votes

I have a shop on Shopify, and my theme allows a good amount of customization. However, it uses a "page blocks" structure, and each block has the same wrapping div.

<div class="index-section">

So on a page with 10 sections, they each have the class name. I can easily add a unique identifier to each section type (e.g., "image hero, custom HTML, rich text"), but if I have a page with 10 custom HTML sections, is there a way to dynamically add some kind of auto-generated string to a class so each one would have a different class? Example:

<div class="index-section s01"></div>
<div class="index-section s02"></div>
<div class="index-section s03"></div>
1

1 Answers

2
votes

You might use the section id:

<div class="index-section {{ section.id }}"></div>

Documentation: https://help.shopify.com/en/themes/liquid/objects/section#section-id