Slack community Log in Book a demo

How Can I Contextualize The Template?

Learn how to customize and apply templates effectively to suit different contexts and meet specific needs.

  • Edit this pageOpen in Helpjuice editor

Is possible to hide or show different parts of your template according to the current page being accessed using liquid tags.

This is a fairly simple process that essentially just require some test conditions, and those test out which page the user is currently on,  there are some specific tags like:

  • on_show_question_page: Variable that returns a true value if the current page is a question;
  • on_index_page: Variable that returns a true value if the current page is the index page;
  • on_contact_us_page: Variable that returns a true value if the current page is the contact-us page;

and using a similar tactic you can also test the code below

category != null

the latter being actually a logical text that could be read as “ category is not null”.

 

An example of usage for the tags:

{% if on_show_question_page %}
  <!--content for question page>
{% elsif on_index_page %}
  <!--content for index page-->
{% elsif on_contact_us_page %}
  <!--content for contact page→
{% elsif category != null %}
  <!--content for category page-->
{% endif %}