How to 'hide' the IP Redirect on certain pages

In some cases, you might want the IP redirect to not trigger on certain page types (such as a blog).

To do this, inside theme.liquid when you add the IP redirect code, add some 'unless' tags based on the template type, like this:

Normally you would have something like this in your theme.liquid file:

{% if settings.redirect_use %}
{% include 'redirect-message' %}
{{ 'redirect.js' | asset_url | script_tag }}

<script>
IPRedirect.init({{ settings | json }});
IPRedirect.run();
</script>
{% endif %}

--

Update it to the following instead, putting the 'unless' tags around it, with the template of the type of page
where you want to hide it, such as 'blog', 'article', etc:

{% unless template contains 'blog' %}

{% if settings.redirect_use %}
{% include 'redirect-message' %}
{{ 'redirect.js' | asset_url | script_tag }}

<script>
IPRedirect.init({{ settings | json }});
IPRedirect.run();
</script>
{% endif %}

{% endunless %}

--

That will mean that the IP redirect script won't trigger on that page type.  For example, if you updated it as above, it would not trigger on your 'blog' pages.  

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk