xmitter-11ty/feed/json.njk
Jens Oliver Meiert 3d0eefe897 fix: convert URLs in post content
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
2021-06-15 10:45:29 +02:00

33 lines
1.0 KiB
Plaintext

---
# Metadata comes from _data/metadata.json
permalink: "{{ metadata.jsonfeed.path }}"
eleventyExcludeFromCollections: true
---
{
"version": "https://jsonfeed.org/version/1.1",
"title": "{{ metadata.title }}",
"language": "{{ metadata.language }}",
"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 | reverse %}
{%- set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset -%}
{
"id": "{{ absolutePostUrl }}",
"url": "{{ absolutePostUrl }}",
"title": "{{ post.data.title }}",
"content_html": {% if post.templateContent %}{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | dump | safe }}{% else %}""{% endif %},
"date_published": "{{ post.date | rssDate }}"
}
{%- if not loop.last -%}
,
{%- endif -%}
{%- endfor %}
]
}