Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JSON Feed template for jekyll
---
layout: null
---
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ site.name | xml_escape }}",
"home_page_url": "{{ "/" | absolute_url }}",
"feed_url": "{{ "/feed.json" | absolute_url }}",
"description": {{ site.description | jsonify }},
"icon": "{{ "/apple-touch-icon-152x152.png" | absolute_url }}",
"favicon": "{{ "/favicon.ico" | absolute_url }}",
"expired": false,
"items": [
{% for post in site.posts limit:36 %}
{
"id": "{{ post.url | absolute_url | sha1 }}",
"title": {{ post.title | jsonify }},
"summary": "",
"content_text": {{ post.content | strip_html | strip_newlines | jsonify }},
"content_html": {{ post.content | strip_newlines | jsonify }},
"url": "{{ post.url | absolute_url }}",
{% if post.tags.size > 0 %}"tags": {{ post.tags | jsonify }}, {% endif %}
{% if post.enclosure.size > 1 %}"attachments": [
{
"url": "{{ post.enclosure }}",
"mime_type": "{{ post.enclosure_type }}",
"size_in_bytes": "{{ post.enclosure_lenght }}"
},{% endif %}
"date_published": "{{ post.date | date_to_xmlschema }}",
"date_modified": "{{ post.date | date_to_xmlschema }}",
"author": {
"name": "{{ post.author }}"
}
}{% if forloop.last == false %},{% endif %}
{% endfor %}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment