Nested layouts #603
-
Hi, is there a way to nest {% layout "html" %}
<main>
{% layout "popup" %}
<p>Popup content</p>
{% layout "popup" %}
<p>Other popup content</p>
</main> As a workaround, I'm using {% layout "html" %}
<main>
{% capture content %}
<p>Popup content</p>
{% endcapture %}
{% render "popup", content: content %}
{% capture content %}
<p>Other popup content</p>
{% endcapture %}
{% render "popup", content: content %}
</main> For context, I'm coming from a Handlebars background, and I'm not using LiquidJS with Shopify (just plainly as a templating language), so maybe I'm just approaching this in the wrong way. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This is how liquid layout is designed, we need try our best to align with Shopify so we cannot change existing tags too much. One problem to achieve your use case is there’s no endlayout, so we don’t know where the last child layout tag ends. There’s another approach: move two popups into its own file, and use the layout tag separately. |
Beta Was this translation helpful? Give feedback.
This is how liquid layout is designed, we need try our best to align with Shopify so we cannot change existing tags too much. One problem to achieve your use case is there’s no endlayout, so we don’t know where the last child layout tag ends.
There’s another approach: move two popups into its own file, and use the layout tag separately.