distinct
(field_name
)Returns a set
with all values for field_name
of all
Records in this query.
If your blog posts have a field called tags
:
# blog-post.ini
[field.tags]
name = Tags
type = strings
You can display all your blog posts' tags with:
{% set tags = site.query('/blog').distinct('tags') %}
{% if tags %}
<ul>
{% for tag in tags|sort %}
<li>{{ tag }}</li>
{% endfor %}
</ul>
{% endif %}
Comments