Skip to main content

IF/ELSE Liquid snippet to check for homepage

  • February 4, 2016
  • 1 reply
  • 97 views

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!

This topic has been closed for replies.

1 reply

  • Community Debut
  • March 4, 2016

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 %}