From 9f348bdb8382f25aacca4cc573963c69fe27ae3d Mon Sep 17 00:00:00 2001 From: lexi <100533118+lx-is@users.noreply.github.com> Date: Mon, 21 Mar 2022 05:09:59 +0000 Subject: [PATCH] RSS Autodiscovery for rss/json feed (#714) Signed-off-by: Daniel Gray --- _includes/head.html | 4 ++++ feed.json | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 feed.json diff --git a/_includes/head.html b/_includes/head.html index c7a5bb57..22be5097 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -25,6 +25,10 @@ {{ site.data.schema.organization | jsonify }} + + + + diff --git a/feed.json b/feed.json new file mode 100644 index 00000000..66c1df11 --- /dev/null +++ b/feed.json @@ -0,0 +1,25 @@ +--- +layout: null +--- +{ + "version": "https://jsonfeed.org/version/1", + "title": "{{ site.title | xml_escape }}", + "description": {{ site.description | jsonify }}, + "home_page_url": "{{ "/" | absolute_url }}", + "feed_url": "{{ "/feed.json" | absolute_url }}", + "user_comment": "This feed allows you to read the posts from this site in any feed reader that supports the JSON Feed format.", + "items": [{% for post in site.posts %} + { + "id": "{{ post.url | absolute_url }}", + "url": "{{ post.url | absolute_url }}", + "title": {{ post.title | jsonify }}, + "content_html": {{ post.content | jsonify }}, + "date_published": "{{ post.date | date_to_xmlschema }}", + "authors": [{% for author in post.author %} + { + "name": "{{ author }}" + }{% unless forloop.last %}, {% endunless %}{% endfor %} + ] + }{% unless forloop.last %},{% endunless %}{% endfor %} + ] +} \ No newline at end of file