CMS Development

BnO-Dev
Member | Diamond Partner
Member | Diamond Partner

Sort blog tags with latin characters

SOLVE

Hi there,

 

I've been developing in hubspot for a few months and I'm trying to sort a blog tags list but i'm getting an "error" due to language, i have some tags that start with an accented letter, i know it's not the same character and the ascii value of the character is bigger, but it's the same letter, so the word "Ética" should be between "Emprendimiento" and "Evaluación", any ideas of how can i achieve this?

 

Thanks!

Screen Shot 2020-10-16 at 11.46.10.png

0 Upvotes
1 Accepted solution
Anton
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Sort blog tags with latin characters

SOLVE

Hi @BnO-Dev

you can do this. simly create a new module with following base code(you can add styling elements as you want/need):

{{ blog_tags('module.blog_selector',250) }}
{% set custom_tag_filter = blog_tags|sort(False, False, 'name')%}

<ul>
   {% for tag in custom_tag_filter %} 
      <li>{{tag.name}}</li>
   {% endfor%}
</ul>

I've added a blog selector called "blog selector" so you and/or your users can select blog specific tags without changing a single line of code.

blog-selector.PNG

This is also great if you want to display tags outside of your blog. But if you have only one blog you can change 
"module.blog_selector" from line 1 to "default".

 

best, 

Anton

 

Anton Bujanowski Signature

View solution in original post

1 Reply 1
Anton
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Sort blog tags with latin characters

SOLVE

Hi @BnO-Dev

you can do this. simly create a new module with following base code(you can add styling elements as you want/need):

{{ blog_tags('module.blog_selector',250) }}
{% set custom_tag_filter = blog_tags|sort(False, False, 'name')%}

<ul>
   {% for tag in custom_tag_filter %} 
      <li>{{tag.name}}</li>
   {% endfor%}
</ul>

I've added a blog selector called "blog selector" so you and/or your users can select blog specific tags without changing a single line of code.

blog-selector.PNG

This is also great if you want to display tags outside of your blog. But if you have only one blog you can change 
"module.blog_selector" from line 1 to "default".

 

best, 

Anton

 

Anton Bujanowski Signature