Skip to content

Instantly share code, notes, and snippets.

@old-school-devv
Created May 20, 2017 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save old-school-devv/6ca0579c2f202cbe11f75dfe6851ff61 to your computer and use it in GitHub Desktop.
Save old-school-devv/6ca0579c2f202cbe11f75dfe6851ff61 to your computer and use it in GitHub Desktop.
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