CMS Development

karensantana
Mitglied

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

lösung

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 Akzeptierte Lösung
Jsum
Lösung
Autorität

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

lösung

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

Lösung in ursprünglichem Beitrag anzeigen

3 Antworten
Jsum
Lösung
Autorität

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

lösung

@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 %}
karensantana
Mitglied

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

lösung

Thank you! It worked like a charm!

tjoyce
Trendsetter/-in | Elite Partner
Trendsetter/-in | Elite Partner

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

lösung

@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