Skip to content

Instantly share code, notes, and snippets.

@ckunte ckunte/feed.json
Last active Mar 7, 2020

Embed
What would you like to do?
JSON feed template in Jinja
{% from 'site_settings.jinja2' import site_title, site_author, site_url -%}
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ site_title }}",
"description": "Description of the website",
"home_page_url": "{{ site_url }}",
"feed_url": "{{ site_url }}/feed.json",
"author": {
"name": "{{ site_author }}",
"url": "{{ site_url }}"
},
"items": [
{%- for entry in entries %}
{
"title": {{ entry.title | tojson }},
"date_published": "{{ entry.year }}-{{ entry.month }}-{{ entry.day }}T{{ entry.hour }}:{{ entry.minute }}:{{ entry.second }}+00:00",
"url": "{{ site_url}}/{{ entry.url }}",
"id": {{ entry.url | tojson }},
"content_text": {{ entry.summary | tojson }},
"content_html": {{ entry.content | tojson }}
}{%if not loop.last %},{%endif%}
{%- endfor %}
]
}
# Site settings
# Site name
{%- set site_title = "yoursite.net" -%}
# Site url (end without /)
{%- set site_url = "https://yoursiteurl.net" -%}
# Author
{%- set site_author = "Your Name" -%}
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.