Skip to content

Instantly share code, notes, and snippets.

@stuartbreckenridge
Last active December 8, 2017 06:49
Show Gist options
  • Save stuartbreckenridge/142fdcc8736f33e36d407746f2607169 to your computer and use it in GitHub Desktop.
Save stuartbreckenridge/142fdcc8736f33e36d407746f2607169 to your computer and use it in GitHub Desktop.
JSON Feed for Jekyll
---
sitemap: false
---
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ site.title }}",
"home_page_url": "{{ site.url }}/",
"feed_url": "{{ site.url }}/feed.json",
"author": {
"name": "{{ site.author }}"
},
"items": [
{% for post in site.posts limit:20 %}
{
"id": "{{ post.identifier }}",
"title": "{{ post.title | cdata_escape }}",
"content_html": {{ post.content | jsonify }},
"url": "{{ site.url }}/{{ post.url }}",
"summary": "{{ post.excerpt }}",
{% if post.link %}"external_url": "{{ post.link }}",{% endif %}
{% if post.image %}"image": "{{ post.image }}",{% endif %}
"tags": ["{{ post.tags}}"],
"date_published": "{{ post.date | date_to_xmlschema }}"
}{% if forloop.last == false %},{% else %}{% endif %}{% endfor %}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment