Add tags.json feed
This commit is contained in:
parent
a798306315
commit
97a6de3c42
24
source/tags.json.twig
Normal file
24
source/tags.json.twig
Normal file
|
@ -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 %}
|
||||
]
|
||||
}
|
Reference in a new issue