We have for one of our client a blog where the Tag are mentionned (priority given to the number of post in the tag) therefore there are set in descending order.
We would like to display them in an another order. I've tried several things, but I'am not able to proceed the way I want (I'm not a dev)
It's not nice (if you change the number of tags or its order, you'll have to modify this accordingly) but this is fast, easier to read than a cycle and gets the job done:
Hello Greg, I could help you further if you tell me which kind of sorting you'd like to use. This can be achieved with a "comparator" macro, called just after
{% for item in my_topics %}
to create a new array of "my_topics", sorted the way you want.
It's not nice (if you change the number of tags or its order, you'll have to modify this accordingly) but this is fast, easier to read than a cycle and gets the job done:
Aug 21, 20198:56 AM - edited Aug 21, 20198:58 AM
Member
Issue with Tag diplaying on the blog
SOLVE
Just to be clearer, if order (number of posts in category) is gonna change, you still have to do a simple cycle like this (translate it to Hubl sintax):
set (array = empty array with same length of tags array) for (item in tags) {
if (item == 'The first tag you want to display') {
array[0] = item;
} elseif (item == 'The second tag you want to display') {
array[1] = item;
} and so on.
} endfor.
After that, to print on screen, do the same you did before (a simple FOR (tag in array) generating the list).