My footer's contents change based on specific pages; I need to conditionally load an additional partial into the footer based on the changes. I'm looking to do that using template variables. Right now, I've got a homepage template where I'm trying to pass a string into a template partial, then into a section tag. Next in the default layout, I want to use a yield tag and conditional to pass the value of that string into another template variable.
Homepage.html template
{{ partial:footer/_footer-cta-vars-partial footer_cta_vars="has-cta" }}
_footer-cta-vars-partial.html template partial
{{ section:footer_cta_var }}
{{ footer_cta_vars }}
{{ /section:footer_cta_var }}
default.html layout template
I've tried two different approaches. One with a conditional to check the yield's value. And one where I attempt to pass the yield's value directly into the partial's template variable. Neither works.
( Attempt 1 )
{{ if '{ yield:footer_cta_var }'=="has-cta" }}
{{ partial src="footer/_footer" use_context="true" css_class_vars="'{ yield:footer_cta_var }'" }}
{{ else }}
{{ partial src="footer/_footer" use_context="true" }}
{{ endif }}
.
( Attempt 2 )
{{ partial src="footer/_footer" use_context="true" css_class_vars="'{ yield:footer_cta_var }'" }}