I’m not sure if this is possible, but that’s why I’m checking here. I’ve seen a number of posts on sorting blog topics alphabetically, but I’d like to output blog topics on the order added to the post.
Example, if I add Security, Intelligence, Mapping, I want them to appear in that order. However, by default, they seem to appear in .. I don’t know, the order the tags were created maybe? I can alphabetize them like here but that’s not really what I’m looking for. I’m just using the default loop for the time being.
{% if content.topic_list %}
{% for topic in content.topic_list %}
{{ topic.name }}{#% if not loop.last %},{% endif %#}
{% endfor %}
{% endif %}
Hey @natsumimori, and hi @redbranchmedia ,
it makes me very proud and glad that my thoughts are asked.
Thanks very much :).
I have to admit that I haven’t come into contact with it yet.
But I do my best and I came across it in my research and I think that would be the solution.
I hope that I could help with that.
Best regards
Özcan
Thanks again for your help. Unfortunately, that doesn’t look like it’ll work for what I need. That function allows me to return a specific tag or array of tags from a blog. I want to return the blog tags from the post itself in the order in which they’re added in the back-end. Do you know what the default behavior is? I can’t seem to find info on that either. It seems to maybe be based on when the tags were initially created in the blog itself?
I’ve created an extra module but you can do it directly in the listing HTML
{% set blog_tags = blog_tags('module.blog_field', 250) %}
{% set sorted_tags = blog_tags|sort(False, False, 'name') %}
{% set tag_posts = blog_recent_tag_posts(blog_tags, sorted_tags, 100)|sort(False, False, 'name') %}
{% for post in tag_posts %}
<div class="post-title">{{ post.name }}</div> {# replace this with your single post layout #}
{% endfor %}
edit:
If you decide to create a custom module simply add a “blog” function. By default it will be called “blog_field”. If you give it a custom name replace it in the first line of code.