Show/hide template group depending on if is Listing or Post Page.

SOLVE
karensantana
Member

Hello,

 

I would like to build a logic to hide a template group if im on the Post Page and show it if 'm in the Listing Post Page. Is there a way to do that ? gROUP.PNG

0 Upvotes
1 Accepted solution

Accepted Solutions
Jsum
Solution
Key Advisor

@karensantana,

 

There is a HubL variable for that as well.

 

If you click the gear Icon on the module, and choose to edit the css for that module a popup with appear. There is a text area, second or third down the popup, for wrapping the module in html. You can copy and paste one of the following and place it there.

 

Show on the listing page only:

{% if is_listing_view %}
    {{ html }}
{% endif %}

Hide on listing page:

{% unless is_listing_view %}
    {{ html }}
{% endunless %}

View solution in original post

3 Replies 3
tjoyce
Recognized Expert | Platinum Partner

@karensantana - There is a body class for blog listing and individual blog post. So, you could add the following css to your css file or in the head mark;

 

To hide on the blog listing page but show on the blog post page:

.hs-blog-listing .blog-description {
    display: none;
}

And....

To hide on the blog post page but show on the blog listing page: 

.hs-blog-post .blog-description {
    display: none;
}

tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.

 

Drop by and say Hi to me on slack.

0 Upvotes
Jsum
Solution
Key Advisor

@karensantana,

 

There is a HubL variable for that as well.

 

If you click the gear Icon on the module, and choose to edit the css for that module a popup with appear. There is a text area, second or third down the popup, for wrapping the module in html. You can copy and paste one of the following and place it there.

 

Show on the listing page only:

{% if is_listing_view %}
    {{ html }}
{% endif %}

Hide on listing page:

{% unless is_listing_view %}
    {{ html }}
{% endunless %}

View solution in original post

karensantana
Member

Thank you! It worked like a charm!