Add posts.json feed

This commit is contained in:
Oliver Davies 2020-04-28 17:28:47 +01:00
parent 8c9b9d19dd
commit 7b06480249

20
source/posts.json.twig Normal file
View file

@ -0,0 +1,20 @@
---
permalink: posts.json
use: [posts]
---
{
"posts": [
{% for post in data.posts|reverse %}
{
"id": "{{ loop.index }}",
"title": {{ post.title|json_encode|raw }},
"created": "{{ post.date }}",
"updated": "{{ post.date }}",
"path": "{{ post.url|trim('/', 'right') }}",
"content": {{ post.blocks.content|json_encode|raw }},
"status": "{{ post.draft ? '0' : '1' }}"
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}