Skip to content

Commit 3cfeef0

Browse files
authored
Merge pull request #104 from orionrobots/fix-rss
Fix rss
2 parents 6e357cf + 067aa67 commit 3cfeef0

File tree

3 files changed

+31
-18
lines changed

3 files changed

+31
-18
lines changed

.eleventy.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ module.exports = function(eleventyConfig) {
119119
});
120120

121121
// Liquid filter to convert a date to a string
122-
eleventyConfig.addLiquidFilter("date_to_string", date => date.toString() );
123122

124123
// Liquid filter for long date string
125124
eleventyConfig.addLiquidFilter("date_to_long_string", function(date) {
@@ -140,6 +139,9 @@ module.exports = function(eleventyConfig) {
140139
eleventyConfig.addGlobalData("site_title", () => getDataFromConfigYaml("title"));
141140
eleventyConfig.addGlobalData("site_tagline", () => getDataFromConfigYaml("tagline"));
142141
eleventyConfig.addGlobalData("production_url", () => getDataFromConfigYaml("production_url"));
142+
eleventyConfig.addGlobalData("JB", () => getDataFromConfigYaml("JB"));
143+
eleventyConfig.addGlobalData("author", () => getDataFromConfigYaml("author"));
144+
eleventyConfig.addGlobalData("now" , () => new Date());
143145

144146
eleventyConfig.addNunjucksFilter("date", function(date, format) {
145147
return moment(date).format(format);

_includes/layouts/common.liquid

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ theme:
5050
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" rel="stylesheet" />
5151

5252
<!-- atom & rss feed -->
53-
<link href="{{ BASE_PATH }}{{ site.JB.atom_path }}" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed">
54-
<link href="{{ BASE_PATH }}{{ site.JB.rss_path }}" type="application/rss+xml" rel="alternate" title="Sitewide RSS Feed">
53+
<link href="{{ BASE_PATH }}{{ JB.atom_path }}" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed">
54+
<link href="{{ BASE_PATH }}{{ JB.rss_path }}" type="application/rss+xml" rel="alternate" title="Sitewide RSS Feed">
5555
</head>
5656
<body class="template">
5757
<div class="container">

navigation_and_indexes/rss.liquid

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,37 @@
11
---
22
title : RSS Feed
33
permalink: /rss.xml
4+
theme:
5+
name: orionrobots
46
---
7+
{% capture BASE_PATH %}{{ site.production_url }}{% endcapture %}
8+
{% capture ASSET_PATH %}{{ BASE_PATH }}/assets/themes/{{ theme.name }}{% endcapture %}
59
<?xml version="1.0" encoding="UTF-8" ?>
610
<rss version="2.0">
711
<channel>
8-
<title>{{ site.title }}</title>
9-
<description>{{ site.title }} - {{ site.author.name }}</description>
10-
<link>{{ site.production_url }}{{ site.rss_path }}</link>
11-
<link>{{ site.production_url }}</link>
12-
<lastBuildDate>{{ site.time }}</lastBuildDate>
13-
<pubDate>{{ site.time }}</pubDate>
14-
<ttl>1800</ttl>
12+
<title>{{ site.title }}</title>
13+
<description>{{ site.title }} - {{ site.tagline }}</description>
14+
<link>{{ site.production_url }}{{ JB.rss_path }}</link>
15+
<link>{{ site.production_url }}</link>
16+
<language>en-gb</language>
17+
<lastBuildDate>{{ now | date_to_long_string }}</lastBuildDate>
18+
<pubDate>{{ time }}</pubDate>
19+
<ttl>1800</ttl>
20+
<image>
21+
<url>{{ ASSET_PATH }}/images/social-banner.jpg</url>
22+
<title>{{ site.title }}</title>
23+
<link>{{ site.production_url }}</link>
24+
</image>
1525

16-
{% for post in site.posts %}
17-
<item>
18-
<title>{{ post.title }}</title>
19-
<description>{{ post | excerpt }}</description>
20-
<link>{{ site.production_url }}{{ post.url }}</link>
21-
<guid>{{ site.production_url }}{{ post.id }}</guid>
22-
<pubDate>{{ post.date }}</pubDate>
23-
</item>
26+
{% assign posts = collections.all | reverse | with_explicit_date %}
27+
{% for post in posts %}
28+
<item>
29+
<title>{{ post.title }}</title>
30+
<description>{{ post | excerpt | strip_html }}</description>
31+
<link>{{ site.production_url }}{{ post.url }}</link>
32+
<guid>{{ site.production_url }}{{ post.url }}</guid>
33+
<pubDate>{{ post.date }}</pubDate>
34+
</item>
2435
{% endfor %}
2536

2637
</channel>

0 commit comments

Comments
 (0)