Answered

IF/ELSE Liquid snippet to check for homepage

Hi there, I need to check whether we are on the portal homepage and display different class names, is there a liquid snippet available for that?


Something like


{% if portal.home %}


<!--Do Something Cool-->


{% endif %}


Thanks!


Best Answer

You can use current_tab

 

{% if portal.current_tab == "home" %}
 Cool stuff
{% endif %}

 

Or on current_page

{% if portal.current_page == "topic_list" %}
 Cool stuff
{% endif %}

 

To check for the exact placeholder names you can use just put the following lines on top of your page and go the frontend in your browser.

 

Current page: {% portal.current_page %}
Current tab: {% portal.current_tab %}

 

1 Comment

Answer

You can use current_tab

 

{% if portal.current_tab == "home" %}
 Cool stuff
{% endif %}

 

Or on current_page

{% if portal.current_page == "topic_list" %}
 Cool stuff
{% endif %}

 

To check for the exact placeholder names you can use just put the following lines on top of your page and go the frontend in your browser.

 

Current page: {% portal.current_page %}
Current tab: {% portal.current_tab %}

 

Login or Signup to post a comment