Display blog post by topic or display home page of blog with Hubl

cos

#1

Hello, just a quick question. I am trying to use an if statement with Hubl to display blog posts by topic and otherwise display the blog homepage. For instance, say the topic is Finance, I just want it to display the topics for finance in a listing page that is a different design. So the URL would be like http://blog.com/topic/finance. If it is all topics, just show the homepage of the blog. Here is the code I have right not:

<div class="blog-content">
        <!--LISTING TEST-->
            {% if is_listing_view and topic.name == "finance" %}
            <div class="blog-section">
                <div class="blog-listing-wrapper cell-wrapper clearfix">
                CONTENT HERE FOR SPECIFIC TOPIC
                </div>
            </div>{% else %}
            <!--END OF LISTING TEST-->
           <div class="blog-body-container clearfix">
               <div class="blog-body">
               CONTENT HERE FOR HOMEPAGE OF BLOG
               </div>
           </div>
</div>

Any advice would be appreciated!


#2

Fixed my own question. Basically I was over complicating the if statement. It just needed to read:

{% if topic %}

That fixed it.