I’m trying to retrieve the tags of my current blog post, but so far I could only get tags from all blog posts (articles)… Anyone has any idea?
ps: It gives me one output per line (one line for each blog post).
{% for article in blog.articles %}
{% if article.tags != blank %}
TAGS:
{% for tag in article.tags %}
{{ tag }}{% unless forloop.last %} {% endunless %}
{% endfor %}
{% endif %}
{% endfor %}
tim_1
2
If you’re on an blog post page you should remove the first and the last lines:
Except comparing tags (array) with blank (string) is not quite right.
{% if article.tags.size > 0 %}
TAGS:
{% for tag in article.tags %}
{{ tag }}{% unless forloop.last %} {% endunless %}
{% endfor %}
{% endif %}
.
Amazing @tim_1 !! Thanks a lot!
So simple… I feel for my last 1+ hour trying to find a solution.
ps: also, for those that like AI, none of them could get it right… not so powerful now, huh?