-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional sections in theme.js #116
Comments
You can just create an new Layout page (just copy the main one into a new one) and replace the footer in this layout. Then u can use it in any template u want. This way you don't have to use the logic at all |
Thanks @aminediboune! I appreciate your quick response, but I don't yet fully understand how to execute the changes since I'm new to Shopify. My understanding of the changes would be:
|
Hope this explains it better |
Thanks @aminediboune! That definitely helped to clarify! I tried this out, and unfortunately it didn't work for me. I still experienced the same behavior after trying to create a home-theme.liquid file and add the layout to the index.liquid (which may have been the wrong approach, but I felt that creating a specialized theme for the index page would be a bit cleaner than creating and adding a new layout to every other page). What ended up working for me was changing a param on the operator routing, which I believe confuses Shopify's ability to correctly pass the template parameter into the code. I added the following snippet. Here's what my new router definition in const router = operator('#root', [
/**
* creates a page transition
* @see https://github.com/estrattonbailey/operator#transition-animation
*/
{
'path': '/',
ignore: true,
},
() => new Promise(res => {
document.body.classList.add('is-transitioning')
setTimeout(res, 200)
setTimeout(() => document.body.classList.remove('is-transitioning'), 300)
})
]) Specifically, the Closing for now, but if anyone has additional context to add I'd be curious to hear! |
Actually, I realize it's probably better to leave this open in case someone has a fix that would avoid having to use this hack-y approach. |
My bad, I forgot to say that you need to set Even Layouts use the main layout. |
Unfortunately, when I attempt this, it seems like
|
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) andfooter.liquid
(all other pages).To swap out these footers, I've added the following snippet of code in our theme.liquid:
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
Any support here would be greatly appreciated!
The text was updated successfully, but these errors were encountered: