Skip to content

Instantly share code, notes, and snippets.

@jthingelstad
Created May 2, 2020 13:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jthingelstad/e5ea874fcca7ff96b15fd84031211b81 to your computer and use it in GitHub Desktop.
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