CMS Development

Marius
Participant | Platinum Partner
Participant | Platinum Partner

Change the order of listing on HubL function

SOLVE

Hi, currently i display the list of topics by doing this:

 

<ul>
{% set blog_topics = blog_topics('testing blog', 250) %}
{% for item in blog_topics %}
<li class="hs-menu-item hs-menu-depth-1">
<a href="{{ group.absolute_url }}/topic/{{item.slug}}">{{ item }}</a>
</li>
{% endfor %}
</ul>

The problem is that this will display the list of topic by  descending order but i want  ascending order. Is there anyway to do that?

 

And other question about the first parameter of 

blog_topics('testing blog', 250)

 Is it the name of the blog cause when i change that to whatever, it still works well with my current blog.

0 Upvotes
1 Accepted solution
JasonRosa
Solution
HubSpot Employee
HubSpot Employee

Change the order of listing on HubL function

SOLVE

Hey @Marius If you wanted to reverse the order of the topics in your example you could use the reverse HubL filter (http://designers.hubspot.com/docs/hubl/hubl-supported-filters#reverse) on the for loop or you could look into using the HubL sort filter as well (http://designers.hubspot.com/docs/hubl/hubl-supported-filters#sort). I hope that helps! 

View solution in original post

1 Reply 1
JasonRosa
Solution
HubSpot Employee
HubSpot Employee

Change the order of listing on HubL function

SOLVE

Hey @Marius If you wanted to reverse the order of the topics in your example you could use the reverse HubL filter (http://designers.hubspot.com/docs/hubl/hubl-supported-filters#reverse) on the for loop or you could look into using the HubL sort filter as well (http://designers.hubspot.com/docs/hubl/hubl-supported-filters#sort). I hope that helps!