How can I use wildcard characters for hiding headers and footers on multiple templates?

How can I use wildcard characters for hiding headers and footers on multiple templates?

WhyRegister
Tourist
6 0 0

What I am trying to do:

  • Set up a number of templates for landing pages, each with very similar goals and structure (just different content)
  • Exclude header, footer, and popups on each
  • Use a wildcard character to handle matching template names


Where I am at:

  • I understand that each new landing page needs a new template. The first one I did is called "opt-in-page", and the next one I am doing is "opt-in-page-2". 
  • I successfully hid the headers and footers via the UNLESS argument and making changes in the theme.liquid file. If I can find the link to the other person who sent me to the right youtube video, I'll link that here and 👍 that person. EDIT: Can't find the right post but this was the video they linked: https://www.youtube.com/watch?v=mxUSrhnbehA
  • I have successfully hidden 1 and 2, but I cannot get a wildcard argument to work. I think it's just syntax since I don't know the language that the theme.liquid is written in.

The following have worked thus far:

{% unless template.suffix == 'opt-in-page' %}
    {% section 'announcement' %}
    {% section 'header' %}
{% endunless %}

And this works:

{% unless template.suffix == 'opt-in-page' or template.suffix == 'opt-in-page-2' %}
    {% section 'announcement' %}
    {% section 'header' %}
{% endunless %} 

What I tried and did NOT work (assuming that the * is a normal wildcard character):

{% unless template.suffix == 'opt-in-page*' %}
    {% section 'announcement' %}
    {% section 'header' %}
{% endunless %}

I anticipate dozens of nearly-identical opt-in pages over the coming year and do not want to have to add code to this file every time I make one if they all follow the same naming convention.

 

Thanks in advance for any suggestions on how to use the wildcard!

 

Replies 0 (0)