Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Jekyll template to create JSONFeed for all posts in site
---
layout: null
---
{
"version": "https://jsonfeed.org/version/1",
"title": {{ site.title | jsonify }},
"author": {
"name": {{ site.author | jsonify }},
"url": "{{ site.url }}{{ site.baseurl }}{% link about/index.md %}",
"avatar": "https://s.gravatar.com/avatar/54e9f4f6495f7b7a218ae7051a173645?s=500"
},
"description": {{ site.description | jsonify }},
"home_page_url": "{{ site.url }}{{ site.baseurl }}",
"feed_url": "{{ site.url }}{{ site.baseurl }}/feed.json",
"icon": "https://s.gravatar.com/avatar/54e9f4f6495f7b7a218ae7051a173645?s=500",
"items": [
{% for post in site.posts %}
{
"id": "{{ site.url }}{{ site.baseurl }}{{ post.url }}",
"title": {{ post.title | jsonify }},
{% if post.author %}"author": {{ post.author | jsonify }}, {% endif %}
{% if post.description %}"summary": {{ post.description | jsonify }}, {% endif %}
{% if post.image %}"image": {{ post.image | jsonify }}, {% endif %}
"content_html": {{ post.content | jsonify }},
"date_published": "{{ post.date | date_to_xmlschema }}",
"url": "{{ site.url }}{{ site.baseurl }}{{ post.url }}"
}{% if forloop.last == false %},{% endif %}
{% endfor %}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.