✨ clean up feeds
This commit is contained in:
parent
2592e84d07
commit
0853782914
@ -45,6 +45,8 @@ module.exports = function (eleventyConfig) {
|
|||||||
|
|
||||||
// Convert publish date into a Date object
|
// Convert publish date into a Date object
|
||||||
post.date = new Date(post.published_at);
|
post.date = new Date(post.published_at);
|
||||||
|
post.published_at = new Date(post.published_at);
|
||||||
|
post.updated_at = new Date(post.updated_at);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Bring featured post to the top of the list
|
// Bring featured post to the top of the list
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"feed": {
|
"feed": {
|
||||||
"filename": "feed.xml",
|
"filename": "feed.xml",
|
||||||
"path": "/feed.xml",
|
"path": "/feed.xml",
|
||||||
"id": "https://walkah.blog/"
|
"id": "https://walkah.blog/feed.xml"
|
||||||
},
|
},
|
||||||
"jsonfeed": {
|
"jsonfeed": {
|
||||||
"path": "/feed.json",
|
"path": "/feed.json",
|
||||||
|
@ -3,12 +3,11 @@ permalink: "{{ metadata.feed.path | url }}"
|
|||||||
eleventyExcludeFromCollections: true
|
eleventyExcludeFromCollections: true
|
||||||
---
|
---
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
|
||||||
<title>{{ metadata.title }}</title>
|
<title>{{ metadata.title }}</title>
|
||||||
<subtitle>{{ metadata.feed.subtitle }}</subtitle>
|
|
||||||
{% set absoluteUrl %}{{ metadata.feed.path | url | absoluteUrl(metadata.url) }}{% endset %}
|
{% set absoluteUrl %}{{ metadata.feed.path | url | absoluteUrl(metadata.url) }}{% endset %}
|
||||||
<link href="{{ absoluteUrl }}" rel="self"/>
|
<link href="{{ absoluteUrl }}" rel="self" type="application/atom+xml" />
|
||||||
<link href="{{ metadata.url }}"/>
|
<link href="{{ metadata.url }}" type="text/html" />
|
||||||
<updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
|
<updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
|
||||||
<id>{{ metadata.feed.id }}</id>
|
<id>{{ metadata.feed.id }}</id>
|
||||||
<author>
|
<author>
|
||||||
@ -19,10 +18,22 @@ eleventyExcludeFromCollections: true
|
|||||||
{% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %}
|
{% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{ post.title }}</title>
|
<title>{{ post.title }}</title>
|
||||||
<link href="{{ absolutePostUrl }}"/>
|
<link href="{{ absolutePostUrl }}" rel="alternate" type="text/html" title="{{ post.title }}" />
|
||||||
<updated>{{ post.date | rssDate }}</updated>
|
<pubdate>{{ post.published_at | rssDate }}</pubdate>
|
||||||
|
<updated>{{ post.updated_at | rssDate }}</updated>
|
||||||
<id>{{ absolutePostUrl }}</id>
|
<id>{{ absolutePostUrl }}</id>
|
||||||
|
<summary type="html">{{ post.excerpt | htmlToAbsoluteUrls(absolutePostUrl) }}</summary>
|
||||||
<content type="html">{{ post.html | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
|
<content type="html">{{ post.html | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
|
||||||
|
<author>
|
||||||
|
<name>{{ metadata.author.name }}</name>
|
||||||
|
</author>
|
||||||
|
{% if post.primary_tag %}
|
||||||
|
<category term="{{ post.primary_tag.name }}" />
|
||||||
|
{% endif %}
|
||||||
|
{% if post.feature_image %}
|
||||||
|
<media:thumbnail url="{{ post.feature_image }}" />
|
||||||
|
<media:content medium="image" url="{{ post.feature_image }}"/>
|
||||||
|
{% endif %}
|
||||||
</entry>
|
</entry>
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
</feed>
|
</feed>
|
@ -8,10 +8,11 @@ eleventyExcludeFromCollections: true
|
|||||||
"home_page_url": "{{ metadata.url }}",
|
"home_page_url": "{{ metadata.url }}",
|
||||||
"feed_url": "{{ metadata.jsonfeed.url }}",
|
"feed_url": "{{ metadata.jsonfeed.url }}",
|
||||||
"description": "{{ metadata.description }}",
|
"description": "{{ metadata.description }}",
|
||||||
"author": {
|
"authors": [{
|
||||||
"name": "{{ metadata.author.name }}",
|
"name": "{{ metadata.author.name }}",
|
||||||
"url": "{{ metadata.author.url }}"
|
"url": "{{ metadata.author.url }}"
|
||||||
},
|
}],
|
||||||
|
"language": "en",
|
||||||
"items": [
|
"items": [
|
||||||
{%- for post in collections.posts | reverse %}
|
{%- for post in collections.posts | reverse %}
|
||||||
{%- set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset -%}
|
{%- set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset -%}
|
||||||
@ -19,8 +20,11 @@ eleventyExcludeFromCollections: true
|
|||||||
"id": "{{ absolutePostUrl }}",
|
"id": "{{ absolutePostUrl }}",
|
||||||
"url": "{{ absolutePostUrl }}",
|
"url": "{{ absolutePostUrl }}",
|
||||||
"title": "{{ post.title }}",
|
"title": "{{ post.title }}",
|
||||||
|
"summary": "{{ post.excerpt }}",
|
||||||
"content_html": {% if post.html %}{{ post.html | dump | safe }}{% else %}""{% endif %},
|
"content_html": {% if post.html %}{{ post.html | dump | safe }}{% else %}""{% endif %},
|
||||||
"date_published": "{{ post.date | rssDate }}"
|
{% if post.feature_image %}"image": "{{ post.feature_image }}",{% endif %}
|
||||||
|
"date_published": "{{ post.published_at | rssDate }}",
|
||||||
|
"date_modified": "{{ post.updated_at | rssDate }}"
|
||||||
}
|
}
|
||||||
{%- if not loop.last -%}
|
{%- if not loop.last -%}
|
||||||
,
|
,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user