Hide Header and Footer Only on the Homepage

Topic summary

A Shopify store owner wants to hide the header and footer exclusively on the homepage while keeping them visible on other pages. Their initial code implementation in theme.liquid partially worked but caused duplication issues.

Solution provided:

  • Navigate to Shopify admin → Online Store → Themes → Actions → Edit code
  • Open the theme.liquid file
  • Locate the </body> tag
  • Insert conditional code that checks if the template name equals ‘index’
  • Wrap header and footer includes with this conditional logic
  • Save changes

Outcome:
The solution successfully resolved the issue. The header and footer now display correctly on all pages except the homepage, eliminating the duplication problem.

Summarized with AI on November 5. AI used: claude-sonnet-4-5-20250929.

I’m working on customizing my Shopify store and I’ve encountered an issue. I want the header and footer to be hidden only on the homepage, but visible on all other pages. I included a code snippet in the theme.liquid file that works to some extent, but not completely.

Here is the code I used:

{% if template.name != 'index' %}
  {% include 'header' %}
{% endif %}

{{ content_for_layout }}

{% if template.name != 'index' %}
  {% include 'footer' %}
{% endif %}

it works but it is duplicated and generates header and footer

HEEELP MEE PLEASE !! I AM NOOOB

1 Like

Hi @hatmakerr

Check this one.

From your Shopify admin dashboard, click on “Online Store” and then “Themes”

Find the theme that you want to edit and click on “Actions” and then “Edit code”.

In the “theme. Liquid” file. Find the tag and paste the code below before the tag.

{% if template.name == 'index' %}

{% endif %}

And Save.

Please don’t forget to Like and Mark Solution to the post that helped you. Thanks!

1 Like

YYEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES you helped me a lot!! hours trying and with your help it worked perfectly! I love you

Welcome! Would you mind hitting ‘like’ as well? Thanks!

1 Like