Skip to content

Commit

Permalink
Tweak blog post rss feed
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdoc committed Feb 13, 2023
1 parent 752cb8d commit cc288b3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
16 changes: 9 additions & 7 deletions src/_data/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ module.exports = function () {
// TODO: Move this all out to Wordpress
return {
title: "The Globe Church",
subtitle: "All about Jesus. Made up of all sorts of people. Involved in the greatest mission…",
sundays: "The Globe Church meets each Sunday, <strong>4pm</strong> at <strong>Ark Globe Academy, Harper Road, London, SE1 6AF</strong>.<br /><br />It's just a few minutes walk from Elephant and Castle Underground station.",
subtitle:
"All about Jesus. Made up of all sorts of people. Involved in the greatest mission…",
sundays:
"The Globe Church meets each Sunday, <strong>4pm</strong> at <strong>Ark Globe Academy, Harper Road, London, SE1 6AF</strong>.<br /><br />It's just a few minutes walk from Elephant and Castle Underground station.",
feed: {
url: "https://www.globe.church/blog/feed.xml"
url: "https://www.globe.church/blog/feed.xml",
},
url: "https://globe.church",
url: "https://www.globe.church",

instagram: "theglobechurch",
twitter: "theglobechurch",
facebook: "theglobechurch",
youtube: "theglobechurch",
linkedin: "theglobechurch",
email: "[email protected]",
registeredAddress: "GlobeOffice, 83 Mill Lofts, County St, London SE1 4AD"
}
}
registeredAddress: "GlobeOffice, 83 Mill Lofts, County St, London SE1 4AD",
};
};
43 changes: 26 additions & 17 deletions src/blog/feed.njk
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
---
permalink: blog/feed.xml
eleventyExcludeFromCollections: true
---json
{
"permalink": "blog/feed.xml",
"eleventyExcludeFromCollections": true,
"metadata": {
"language": "en",
"url": "https://www.globe.church",
"author": {
"name": "The Globe Church"
}
}
}
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ meta.title }}</title>
<subtitle>{{ meta.subtitle }}</subtitle>
<link href="{{ meta.feed.url }}" rel="self"/>
<link href="{{ meta.url }}"/>
<updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
<id>{{ meta.feed.url }}</id>
<author>
<name>{{ metadata.title }}</name>
</author>
{% for post in posts %}
<title>{{ meta.title }}</title>
<subtitle>{{ meta.subtitle }}</subtitle>
<link href="{{ permalink | absoluteUrl(metadata.url) }}" rel="self"/>
<link href="{{ metadata.url }}"/>
<updated>{% set latest = posts | first %}{{ latest.date | jsDate | dateToRfc3339 }}</updated>
<id>{{ metadata.url }}</id>
<author>
<name>{{ metadata.author.name }}</name>
</author>
{% for post in posts %}
{% set authorDetails = post.author | authorLookup(people) %}
{% set path %}blog/{{ post.slug }}/{% endset %}
{% set absolutePostUrl %}{{ path | url | absoluteUrl(meta.url) }}{% endset %}
<entry>
<title>{{ post.title.rendered | safe }}</title>
<title>{{ post.title }}</title>
<link href="{{ absolutePostUrl }}" />
<author>{{ authorDetails.name }}</author>
<pubdate>{{ post.date | jsDate | rssDate }}</pubdate>
<pubdate>{{ post.date | jsDate | dateToRfc3339 }}</pubdate>
<id>{{ absolutePostUrl }}</id>
<content type="html">{{ post.content.rendered | safe | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
<content xml:lang="{{ metadata.language }}" type="html">{{ post.content.rendered | safe | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
</entry>
{% endfor %}
{% endfor %}
</feed>

0 comments on commit cc288b3

Please sign in to comment.