Check if Site is a Blog-Article (Single-View)

Hello everyone,

In the HubSpot documentary you can find the following if statement to check if the page is a blog-listing-view:

{% if is_listing_view %}

You can also change this to if is not listing view:

{% if !is_listing_view %}

But is there also an if-statement to check if it is a single blog-view?

Thank you so much and have a great day!

Hey @peesen

Adding @dbeau79 and @jonchim here so they can race each other to the solution for you :horse_racing:

@dennisedsonCan we please get a direct response from HubSpot about this topic. This would be really nice an i think a lot of developers would be interested. Thank you so much.

@peesen , the answers you have received are correct. ( I work at HubSpot so this is the direct response :grinning_face: )

@peesen @dennisedson Hmm I don’t think i’ve come across anything that uses an if-statement check for single blost post view.

I typically use a separate template for the single blog post. @peesen what would the use-case be for this if statement? Maybe there’s another way to acheive what you’re looking for?

I am also curious :smiley:

@jonchimHey Jon, thank you so much. I use the header as a partial and would like to just specify somethine especially for blog posts. If there is no statement i have to create two different header partials (standard and for blog-posts). I wait if i can get any feedback from hubspot. Have a great day!

@peesen , I tested this in my sandbox from the base.html file and it worked.

 {% if blog and !is_listing_view %}
 <!-- Article specific code -->
 {% endif %}

@dbeau79Awesome! Thank you so much :slightly_smiling_face: