CMS Development

Lorddemos90
Member

If Statement For Blog Index

How would I create an if statement for "If Page Is The Blog Index"?  I have no idea what conditions to hook into and hubspot does not list them at all.   What I basically want to do on the blog index page is:

 

{% if not simple_list_page %}

 

{% if page is the main /blog index page %}  <--THIS IS WHERE I'M LOST.  I CAN'T FIND ANYTHING ON HOW DO TO THIS ANYWHERE.

 

Do stuff for the main /blog index page.

 

{% else %}

Do stuff for all other not-simple listing pages..

{% endif %}

 

{% else %}

Do stuff for simple listing.

 

{% endif %}

 

Somebody throw me a bone, eh?

0 Upvotes
3 Replies 3
benvanlooy
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

If Statement For Blog Index

Why don't you create

 

- one template for the "blog homepage overview" (I think you mean index)

 

- one template for the blog detail ?

 

Which other pages do you need? 🙂

Lorddemos90
Member

If Statement For Blog Index

Well I need two listing styles for the blog index.  For the main /blog page, I need a specific style.  Then for "topic" lists, I need a different style.   If I understand correctly, hubspot only gives you two template options to work with; the index template & the page template.

0 Upvotes
TRooInbound
Key Advisor

If Statement For Blog Index

Hi @Lorddemos90,

 

There are 3 pages code in one index template
1 - Index page main listing page

2 - Topic listing page

3 - Author page 

So you can add class in the main div using this if conditions

{% if topic %}
    <div class="topic-page">
{% elif blog_author %}
    <div class="author-page">
{% else %}
    <div class="main-index-page">
{% endif %}

Did my post help answer your query? Help the Community by marking it as a solution.

Team TRooInbound
hello@trooinbound.com