Can You Show Footer on All Pages Except Homepage?

Solved
Tourist
53 0 1

I'm trying to add a footer to all pages but our homepage. I tried doing this by adding this code to the theme file but it didn't make any change:

{% unless template == 'slideshow.liquid' %}
{% section 'footer.liquid' %}
{% endunless %}

Any ideas what's wrong with that code and why it didn't work?

0 Likes

In theme.liquid try:

{% unless template.name == 'index' %}
  {% section 'footer.liquid' %}
{% endunless %}

This will ensure that the footer is not shown on the home page but will still appear on other pages.

Shopify Partner & Developer
If it's a problem you can't solve the job is not too small - get in touch
littleventures.net
contact@littleventures.net

Print or download a PDF catalog for your store in minutes - Shop-2-Doc
0 Likes
Tourist
53 0 1

Hi, thank you for your response. I just tried that and unfortunately it didn't work.

0 Likes

EDIT: My mistake, use 'footer' instead of 'footer.liquid' in the previously mentioned code.

 

Could you elaborate? Is there still a footer being displayed on the homepage?

 

I may have misunderstood. I assumed you wanted to hide/not display any footer on the homepage. Do you in fact want to display a footer on the homepage and also display a different footer on all other pages?

 

Can I ask which theme you are using?

 

Regards,

Tom

Shopify Partner & Developer
If it's a problem you can't solve the job is not too small - get in touch
littleventures.net
contact@littleventures.net

Print or download a PDF catalog for your store in minutes - Shop-2-Doc
0 Likes
Tourist
53 0 1

Hi, unfortunately that didn't work either. I tried it with 'footer' in both the theme.liquid and the theme.scss.liquid files. A footer still displays on the homepage. I'm using Brooklyn theme. Here is my site: https://illuminatelabs.io/

 

I want to display no footer on the homepage but a footer on all the other pages.

0 Likes

Success.

Hmmm...

 

I've installed the Brooklyn theme and tested it. It definitely works for me. I replaced:

{% section 'footer' %}

...on line 111 of theme.liquid with:

{% unless template.name == 'index' %}
  {% section 'footer' %}
{% endunless %}

Are you maybe adding the new code without removing the old?

 

Regards,

Tom

Shopify Partner & Developer
If it's a problem you can't solve the job is not too small - get in touch
littleventures.net
contact@littleventures.net

Print or download a PDF catalog for your store in minutes - Shop-2-Doc
0 Likes
Tourist
53 0 1

Oh I'm an idiot. I was forgetting to replace the footer section and just putting it at the bottom of the file. Just did that now it works. Thanks so much!

0 Likes