How To Display The Footer Only On The Home Page

I want to remove the footer from all pages and leave it only on the home page, can anyone help me?

1 Like

Hello @KhallP -

Zach from TaskHusky here.

Here are some general instructions on how to accomplish this:

Access Your Theme Files:

From your Shopify admin, go to Online Store > Themes.

Find the theme you want to edit, and then click Actions > Edit code.

Locate the Footer Code:

The footer code might be in different files depending on the theme. Commonly, it is in theme.liquid, footer.liquid (inside the sections folder), or theme.liquid might include it from another file using a {% include %} or {% section %} tag. Look for the code that is responsible for displaying the footer.

Edit the Code:

Once you’ve found where the footer is included, wrap the footer code or the include/section tag that loads the footer with an if statement that checks if the current page is the homepage. You can check if it’s the homepage by using request.path or template object like this:

liquid

Copy code

{% if request.path == ‘/’ %}

{% endif %}

Or, using the template object:

liquid
Copy code

{% if template.name == ‘index’ %}

{% endif %}

Save the Changes:

After adding the conditional statement around the footer code, save your changes.

Test the Change:

Go to your storefront and refresh the page to ensure that the footer only appears on the homepage and not on other pages.

Hi @KhallP

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!

**HI @KhallP **
You can try this step to achieve your result
Step 1: You need to change your footer.liquid file code

![222.png|1780x488](upload://aUVKXRe7fqdzVG2fStQ1lYKkeul.png) **This is your previous code looks like this** **and your output is** ![111.png|1820x884](upload://xqB4NWPGEcFjgm055SSKmEkUi06.png) **Step 2: But if you change some code like this** **Just add one condition**

After doing this the result is

Code:

{% if request.path == routes.root_url %}

{% endif %}

Joy Matubber| Brain Station 23
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more contact us : js.team@brainstation-23.com