Last active
March 7, 2020 01:01
-
-
Save ckunte/162a0c890d3c98c37e704a9c5664356d to your computer and use it in GitHub Desktop.
JSON feed template in Jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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 %} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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