diff --git a/source/tags.json.twig b/source/tags.json.twig new file mode 100644 index 00000000..e89c4dab --- /dev/null +++ b/source/tags.json.twig @@ -0,0 +1,24 @@ +--- +permalink: tags.json +use: [posts] +--- +{% set tags = [] %} + +{% for post in data.posts %} + {% for tag in post.tags %} + {% if tag not in tags %} + {% set tags = tags|merge([ tag ]) %} + {% endif %} + {% endfor %} +{% endfor %} + +{ + "tags": [ + {% for i, tag in tags|sort %} + { + "id": "{{ i }}", + "name": "{{ tag }}" + }{% if not loop.last %},{% endif %} + {% endfor %} + ] +} \ No newline at end of file