We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

How do you find out which layout is in use using liquid?

How do you find out which layout is in use using liquid?

chris-a-io
Shopify Partner
11 0 4

Does anyone know how to find, in liquid, which layout is in use?  I want to use different snippets based on which layout is in use.  I'm finding some workarounds, like for page i can use the .template_suffix, but I'd love to know if there's a more direct way.

 

Something like {{ layout.name }} would be ideal, to give an idea, but I don't see documentation for a layout object like this.  So, if anyone knows of a way, please let me know!

Reply 1 (1)

LitExtension
Shopify Partner
4963 1010 1192

Hi @chris-a-io,

I really don't understand what you want. But if you want to create the different layout you can add a new layout and call a separate layout for templates:

Screenshot.png

Then use the following code: 

{% layout 'name layout' %}

Hope it helps!

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com