سؤال

I have a page which displays a random post every day, and I have made a custom RSS feed page for it. My question is how Mailchimp and similar services (such as IFTTT) that uses RSS feeds detects "New Items"?

Cause my RSS feed looks like this:

<channel>
  <title><b>Quote of the Day</b></title>
  <atom:link rel="self" href="http://www.mysite.com/qotd/feed-2" type="application/rss+xml"/>
  <link>http:/mysite.com/qotd/feed-2</link>
  <description>Textt</description>
  <language>en-us</language>
  <pubDate>Wed, 22 Jan 2014 21:30:45 +0000</pubDate>
  <lastBuildDate>Wed, 22 Jan 2014 21:30:45 +0000</lastBuildDate>
       <item>
            <link>http://www.mysite.com/412</link>
            <pubDate>Wed, 20 Jan 2014 07:17:45 +0000</pubDate>
            <description><![CDATA[]]></description>
            <guid>http://www.mysite.com/412</guid>
       </item>
</channel>
</rss>

Every 24h, the feed updates with a new item. The problem is that there will always be 1 item in total, and the pubdate might be an older date before, depending on which random post it pulls. Will services that uses RSS still detect it as if a new item has been added?

هل كانت مفيدة؟

المحلول

It's not considered good practice to have only a single item in your feed. It exposes you to the risk of missed update if a given service polls the feed unfrequently enough.

The "default" behavior is to poll the feed regularly (every hour, every day... etc) and compare the <item> elements between 2 fetches. They will likely use the <guid> to determine whether an item has already been detected or not.

Additionally, many consuming apps (like IFTTT in your case but I'm not sure for Mailchimp) will support PubSubHubbub which is a webhook protocol so they know when a given feed has been updated. It saves them (and you!) resources because they won't have to poll the feed often and yet will always have timely updates.

Most of the time, the <pubDate> does not matter. Feel free to share the actual URL of your feed so we can tell you exactly what's going on.

نصائح أخرى

That depends on the implementation, but usually they will compare the new item with all items stored locally to determine whether it was in the RSS earlier, and only display it if it's not, thus this should be fine (at least the two RSS feed readers I have used until now worked this way).

If you want the items to be displayed in the order they appeared on your website however you should use the current date instead of the actual date of the item.

There is a helpful troubleshooting guide by Mailchimp. It seems Mailchimp does evaluate the Pubdate to decide that items are published. From the page:

Make sure your pubDate tags are set up and populating correctly. If a pubDate is set in another time zone or a day off, MailChimp may not recognize that the items were posted before the next campaign is triggered. Below is an example of the correct setup for your RSS feed. The pubDate is in English.We pull in the date for any of these tags, in this order: 'pubDate', 'pubdate', 'published', 'created', 'updated', 'date.'

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top