Re: How to remove wrapper divs added via section tags in liquid?

Solved

How to remove wrapper divs added via section tags in liquid?

Javy
Shopify Partner
15 1 4

If I include a section in my theme template via liquid tags as follows:

{% section 'header' %}

 

The resulting output wraps the code contained in the header section with a div:

 

<div id="shopify-section-header" class="shopify-section">
     <!- Content in header.liquid ->
</div>

 

I'd really like to remove the wrapper div for a few reasons - styling, semantic markup, removing excess markup for page size, etc. - but I haven't found any way in the docs to filter this out. Any suggestions? 

Accepted Solution (1)
Javy
Shopify Partner
15 1 4

This is an accepted solution.

Ended up finding the relevant info:

https://shopify.dev/themes/architecture/sections/section-schema#tag

Tag attribute allows modification of the container element.

View solution in original post

Replies 2 (2)

Javy
Shopify Partner
15 1 4

anyone?

Javy
Shopify Partner
15 1 4

This is an accepted solution.

Ended up finding the relevant info:

https://shopify.dev/themes/architecture/sections/section-schema#tag

Tag attribute allows modification of the container element.