How to show all topics in blog listing

SOLVE
Highlighted
Occasional Contributor

I only get the topics associated with the 9 blog posts displayed on each page.

As for now, on my first page of my blog I get 5 topics, when I navigate to the second page, viewing my next 9 blog posts, I get 11 topics. 

 

I would like for all my used topics to be showned on all the blog-listing pages. 

How can I do this?

 

This is my code. (The first part is if any topic is selected, here as well I would like for all topics to be shown after the selected topic.)

 

{% if contents_topics %}
      {% if topic %}
           {% set temp = group.public_title ~ " - Exsitec | "%}
           {% set topicName = page_meta.html_title|replace(temp, '') %} 
           <div class="button-group -inline" style="width:100%">
               <a href="{{ group.absolute_url }}" class="tag-item" style="background-color:#c9c9db">
                   {{ topicName }}
               </a>
          </div>
     {% endif %}
     <div class="button-group -inline">
          {% for thisTopic in contents_topics %}
              {% if thisTopic.slug != topic %}
                  <a href="{% if thisTopic.slug == topic %}{{ group.absolute_url }}{% else %}{{ group.absolute_url }}/topic/{{ thisTopic.slug }}{% endif %}" class="tag-item" style="{% if thisTopic.slug == topic %}background-color:#c9c9db {% endif %}"> <!--class="button -filter">-->
                         {{ thisTopic.name }}
                  </a>
                {% endif %}
            {% endfor %}
         </div>
{% endif %}
Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Top Advisor | Platinum Partner

@hannalofving

You can use the "blog topics" HUBL function to accomplish this. Just modify the second part of your code to use the my_topics loop instead of the contents_topics. Keep in mind that topics that do not belong to any blog posts at all, probably will not appear in this list. But, at least your list won't be limited to just the blog posts that are appearing in the page.

{% set my_topics = blog_topics('default', 250) %}
<ul>
{% for item in my_topics %}
<li><a href="{{ blog_tag_url(group.id, item.slug) }}">{{ item }}</a></li>
{% endfor %}
</ul>

If this answer helped, please, mark as solved 😄


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

2 Replies 2
Top Advisor | Platinum Partner

@hannalofving

You can use the "blog topics" HUBL function to accomplish this. Just modify the second part of your code to use the my_topics loop instead of the contents_topics. Keep in mind that topics that do not belong to any blog posts at all, probably will not appear in this list. But, at least your list won't be limited to just the blog posts that are appearing in the page.

{% set my_topics = blog_topics('default', 250) %}
<ul>
{% for item in my_topics %}
<li><a href="{{ blog_tag_url(group.id, item.slug) }}">{{ item }}</a></li>
{% endfor %}
</ul>

If this answer helped, please, mark as solved 😄


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

Highlighted
Occasional Contributor

Thank you!

It works like a charm.