Simplify the Atom and JSON feeds
This commit is contained in:
parent
294f4c53c1
commit
c780c72770
@ -3,16 +3,6 @@
|
||||
"url": "https://example.com/",
|
||||
"language": "en",
|
||||
"description": "I am writing about my experiences as a naval navel-gazer.",
|
||||
"feed": {
|
||||
"subtitle": "I am writing about my experiences as a naval navel-gazer.",
|
||||
"filename": "feed.xml",
|
||||
"path": "/feed/feed.xml",
|
||||
"id": "https://example.com/"
|
||||
},
|
||||
"jsonfeed": {
|
||||
"path": "/feed/feed.json",
|
||||
"url": "https://example.com/feed/feed.json"
|
||||
},
|
||||
"author": {
|
||||
"name": "Your Name Here",
|
||||
"email": "youremailaddress@example.com",
|
||||
|
@ -1,16 +1,15 @@
|
||||
---
|
||||
# Metadata comes from _data/metadata.json
|
||||
permalink: "{{ metadata.feed.path }}"
|
||||
permalink: /feed/feed.xml
|
||||
---
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ metadata.language }}">
|
||||
<title>{{ metadata.title }}</title>
|
||||
<subtitle>{{ metadata.feed.subtitle }}</subtitle>
|
||||
{% set absoluteUrl %}{{ metadata.feed.path | url | absoluteUrl(metadata.url) }}{% endset %}
|
||||
<link href="{{ absoluteUrl }}" rel="self"/>
|
||||
<subtitle>{{ metadata.description }}</subtitle>
|
||||
<link href="{{ permalink | url | absoluteUrl(metadata.url) }}" rel="self"/>
|
||||
<link href="{{ metadata.url }}"/>
|
||||
<updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
|
||||
<id>{{ metadata.feed.id }}</id>
|
||||
<updated>{{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
|
||||
<id>{{ metadata.url }}</id>
|
||||
<author>
|
||||
<name>{{ metadata.author.name }}</name>
|
||||
<email>{{ metadata.author.email }}</email>
|
||||
@ -20,7 +19,7 @@ permalink: "{{ metadata.feed.path }}"
|
||||
<entry>
|
||||
<title>{{ post.data.title }}</title>
|
||||
<link href="{{ absolutePostUrl }}"/>
|
||||
<updated>{{ post.date | rssDate }}</updated>
|
||||
<updated>{{ post.date | dateToRfc3339 }}</updated>
|
||||
<id>{{ absolutePostUrl }}</id>
|
||||
<content type="html">{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
|
||||
</entry>
|
||||
|
@ -1,13 +1,13 @@
|
||||
---
|
||||
# Metadata comes from _data/metadata.json
|
||||
permalink: "{{ metadata.jsonfeed.path }}"
|
||||
permalink: /feed/feed.json
|
||||
---
|
||||
{
|
||||
"version": "https://jsonfeed.org/version/1.1",
|
||||
"title": "{{ metadata.title }}",
|
||||
"language": "{{ metadata.language }}",
|
||||
"home_page_url": "{{ metadata.url }}",
|
||||
"feed_url": "{{ metadata.jsonfeed.url }}",
|
||||
"feed_url": "{{ permalink | url | absoluteUrl(metadata.url) }}",
|
||||
"description": "{{ metadata.description }}",
|
||||
"author": {
|
||||
"name": "{{ metadata.author.name }}",
|
||||
@ -15,17 +15,15 @@ permalink: "{{ metadata.jsonfeed.path }}"
|
||||
},
|
||||
"items": [
|
||||
{%- for post in collections.posts | reverse %}
|
||||
{%- set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset -%}
|
||||
{%- set absolutePostUrl = post.url | url | absoluteUrl(metadata.url) %}
|
||||
{
|
||||
"id": "{{ absolutePostUrl }}",
|
||||
"url": "{{ absolutePostUrl }}",
|
||||
"title": "{{ post.data.title }}",
|
||||
"content_html": {% if post.templateContent %}{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | dump | safe }}{% else %}""{% endif %},
|
||||
"date_published": "{{ post.date | rssDate }}"
|
||||
"date_published": "{{ post.date | dateToRfc3339 }}"
|
||||
}
|
||||
{%- if not loop.last -%}
|
||||
,
|
||||
{%- endif -%}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{%- endfor %}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user