Closed danvega closed 5 years ago
Hi @danvega
The pubDate
option is the publication date of the feed (you define it in the feedOptions
object). For each individual item, you need to specify a date
key inside feedItemOptions
.
This is what I have
{
use: 'gridsome-plugin-rss',
options: {
contentTypeName: 'Post',
feedOptions: {
title: 'Dan Vega',
feed_url: 'https://danvega.dev/rss.xml',
site_url: 'https://danvega.dev'
},
feedItemOptions: node => ({
title: node.title,
description: node.excerpt,
url: getPostURL(node.fields.date, node.slug),
author: node.fields.author,
date: node.fields.date
}),
output: {
dir: './static',
name: 'rss.xml'
}
}
},
And this is my feed https://www.danvega.dev/feed
Hmm...I'm not sure how Feedly is sorting the items. Other feed readers such as Feeder seem to sort your feed normally.
Since this isn't a bug with the plugin itself, I'm gonna close the issue, but feel free to comment if you find something out!
@danvega - I may have found a solution for your feed to sort properly on Feedly, could you add this to feedItemOptions
and see if it works?
custom_elements: [
{
published: node.fields.date,
},
]
So I did that and no change.
{
use: 'gridsome-plugin-rss',
options: {
contentTypeName: 'Post',
feedOptions: {
title: 'Dan Vega',
feed_url: 'https://danvega.dev/rss.xml',
site_url: 'https://danvega.dev'
},
feedItemOptions: node => ({
title: node.title,
description: node.excerpt,
url: getPostURL(node.fields.date, node.slug),
author: node.fields.author,
date: node.fields.date,
custom_elements: [{
published: node.date,
}, ]
}),
output: {
dir: './static',
name: 'rss.xml'
}
}
},
Posts are showing up in the same order and because I did this yesterday and the build happened yesterday, it shows all of these posts as 1 day ago.
@danvega - can you change published
to node.fields.date
instead of node.date
. The later seems to be giving a UNIX timestamp instead of a date string.
Same issue.
Opened a PR here: https://github.com/danvega/danvega-dev/pull/20
I am so sorry I pushed a commit with your suggestion before I saw the PR. I am still seeing the same issue https://www.danvega.dev/rss.xml
I also see I have a pubDate and published node, should I remove the date from the feedOptions?
<item>
<title>
<![CDATA[ Happy New Year! My 2019 Goals ]]>
</title>
<description>
<![CDATA[ Happy New Year! My 2019 Goals ]]>
</description>
<link>
https://www.danvega.dev/blog/2019/01/01/happy-new-year-my-2019-goals
</link>
<guid isPermaLink="true">
https://www.danvega.dev/blog/2019/01/01/happy-new-year-my-2019-goals
</guid>
<pubDate>Tue, 01 Jan 2019 13:38:10 GMT</pubDate>
<published>Tue Jan 01 2019 13:38:10 GMT+0000 (UTC)</published>
</item>
Huh, that's super weird because my PR preview works fine in Feedly
Maybe they might be pulling in a previous cached version of the live feed?
@danvega Yep, it seems that Feedly caches the RSS, I closed my PR but before that I tested by changing your latest article (excerpt, author & content) and re-pulling the feed into Feedly and it was showing an older version of that article.
One comment I found by googling around is to change the URL of your feed. Maybe try that?
This is fixed, sorry for not closing!
Is there a way to sort them? When I import this feed into feedly it shows my very 1st post at the top even though I have a pubDate on each of them.