Add jsonfeed template

master
Benji Encalada Mora 2019-10-30 13:26:42 -05:00
parent 6b0b772b99
commit a34bf51ce1
No known key found for this signature in database
GPG Key ID: DBEBBE9A2EB76EEB
1 changed files with 38 additions and 0 deletions

38
feed/json.njk Normal file
View File

@ -0,0 +1,38 @@
---
permalink: feed/feed.json
eleventyExcludeFromCollections: true
---
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ metadata.title }}",
"home_page_url": "{{ metadata.url }}",
"feed_url": "{{ metadata.jsonfeed.url }}",
"description": "{{ metadata.description }}",
"author": {
"name": "{{ metadata.author.name }}",
"url": "{{ metadata.author.url }}"
},
"items": [
{%- for post in collections.posts %}
{% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset -%}
{
"id": "{{ absolutePostUrl }}",
"url": "{{ absolutePostUrl }}",
"title": "{{ post.data.title }}",
"content_html": "{{ post.templateContent | jsonContent | safe }}",
"date_published": "{{ post.date | rssDate }}",
"tags": [
{%- for c in post.data.category %}
"{{ c }}"
{%- if not loop.last -%}
,
{%- endif -%}
{%- endfor %}
]
}
{%- if not loop.last -%}
,
{%- endif -%}
{%- endfor %}
]
}