Skip to content

Conditional sections in theme.js #116

@bomanimc

Description

@bomanimc

Summary

For our site, we need to have a different footer design on the home page than the one we use on all of the other pages. There are two separate footer liquid snippets: transparent-footer.liquid (home page) and footer.liquid (all other pages).

To swap out these footers, I've added the following snippet of code in our theme.liquid:

{% if template == 'index' %}
      {% section 'transparent-footer' %}
{% else %}
      {% section 'footer' %}
{% endif %}

I noticed that when I first load the home page, I get the correct footer (transparent-footer.liquid). When I go to another page, I get the correct footer (footer.liquid). But when I return to the home page from one of the other pages, the incorrect footer (footer.liquid) displays. What should I do to correct this? This may be on the Shopify side, but I'm curious to know if there's anything about Slater that might be influencing something like this

So far, I've tried a variety of different variations on the if condition such as: {% if request.page_type == 'index' %} and {% if template.name contains 'index' %}

Exact Repro Steps

  1. Go to https://dial-up-digital-development.myshopify.com/
  2. In the URL bar for your browser, type https://dial-up-digital-development.myshopify.com/collections/all
  3. Click the text in the middle of the header bar that says "HARTFORD" to back to the home page. At this point, you should see the issue.

Any support here would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions