Hi there,
I have a large amount of (collection) pages that have customized design elements, so the standard header/footer is not needed.
Is there an easy way to exclude the header / footer on those?
F.i., through a specific meta-field in each collection?
Topic summary
A user needs to hide the standard header and footer on multiple collection pages that have custom design elements, and asks if this can be done using metafields.
Proposed Solution:
- Create a Boolean metafield (e.g.,
hide_header_footer) in Shopify admin under Settings > Custom Data > Collections - Set the metafield to
truefor collections where header/footer should be hidden - Wrap header/footer rendering in Liquid conditionals that check the metafield value
- Alternative: Create a custom collection template (
collection.custom.liquid) for significantly different layouts
Current Status:
The user reports they cannot locate the expected theme files (collection.liquid or main-collection.liquid) that would contain the header/footer rendering code, indicating they may need help identifying the correct files in their specific theme structure. Another respondent has requested the store link and specific page examples to provide more targeted assistance.
Hey @kbac ,
Yes! A great way to conditionally exclude the header and footer on specific collection pages is by using a metafield on each collection. Here’s how you can do it:
Steps to Implement:
- Add a Metafield to Collections:
-
In your Shopify admin, go to Settings > Custom Data > Collections.
-
Click Add definition, name it something like hide_header_footer.
-
Set the type to Boolean (true/false) so you can easily toggle it.
-
Save and then assign true to the collections where you want to hide the header/footer.
- Modify Your Shopify Liquid Theme Code:
- In your collection.liquid (or main-collection.liquid if you’re using Shopify 2.0), wrap your header and footer with a condition like this:
{% if collection.metafields.custom.hide_header_footer != true %}
{% render 'header' %}
{% endif %}
{% if collection.metafields.custom.hide_header_footer != true %}
{% render 'footer' %}
{% endif %}
- Alternative Approach (Using Templates):
- If you have significantly different layouts, you could create an alternative collection template (collection.custom.liquid) and assign it manually to collections in the admin.
Would you like help with setting up these metafields programmatically via the Shopify API? Please Feel Free to reach out!
If I was able to help you, please don’t forget to Like and mark it as the Solution!
Best Regard,
Rajat
HI @kbac
Could you share the store link with me?
Also, which pages do you want to hide the header/footer on? Please share 3-4 links so I can check and assist accordingly.
Best,
Daisy
Thank you.
I cannot find any file that contains something like render header etc.
There is no collection.liquid (or main-collection.liquid if you’re using Shopify 2.0) or similar.