I have tried to create an rss feed for a client of mine and it works for the most part, however it seems to create duplicate items. Any ideas? Here is the script: <cfcontent reset="true"> <cfquery datasource="#Application.DSN#" name="qryArticles"> SELECT * FROM articles order by datCreateDate desc </cfquery> <cfsavecontent variable="rss"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>Blog</title> <link><cfoutput>#application.root_domain#</cfoutput></link> <description>Blog</description> <lastBuildDate><cfoutput>#dateformat(Application.now, "ddd, dd mmm yyyy")# #timeformat(Application.now, "HH:mm:ss")# EST</cfoutput></lastBuildDate> <language>en-us</language> <atom:link href="<cfoutput>#application.root_domain#</cfoutput>/rss.cfm" rel="self" type="application/rss+xml" /> <cfoutput query="qryArticles"> <cfset articleText = replacenocase(strArticleText,"/index.cfm",application.root_domain & "/index.cfm", "ALL")> <cfset articleText = replacenocase(articleText,"index.cfm",application.root_domain & "/index.cfm", "ALL")> <cfset articleText = replacenocase(articleText,"/Uploaded",application.root_domain & "/Uploaded", "ALL")> <item> <title>#XmlSafeText(strArticleTitle)#</title> <link>#application.root_domain#/index.cfm/fuseaction/post/postid/#qryArticles.intArticleID#-#cleanURL(qryArticles.strArticleTitle)#</link> <guid>#application.root_domain#/index.cfm/fuseaction/post/postid/#qryArticles.intArticleID#-#cleanURL(qryArticles.strArticleTitle)#</guid> <pubDate>#dateformat(datCreateDate, "ddd, dd mmm yyyy")# #timeformat(datCreateDate, "HH:mm:ss")# EST</pubDate> <description>#XmlSafeText(articleText)#</description> </item> </cfoutput> </channel> </rss></cfsavecontent> <cfcontent type="text/xml"> <cfoutput>#rss#</cfoutput> Code (markup):
I know it is being duplicated. I see it in my reader, as well have others report this as well. http://www.targetinsight.ca/rss.cfm It'll duplicate all items at a later date.
The most likely causes are the underlying data and the code generating the feed. So the first thing I'd ask is when you notice these "duplicates", did you check your query ... and the code generating the rss? Does it actually generate what you're calling "duplicates"..?
No, I understood what you meant by duplicates. But only you have to access to the data and code. So you need to look at both to figure out why it's happening. Start with the obvious: your query. You're running a SELECT * but only using a few of those fields in your feed. When you look it from that perspective, is it possible the query would return duplicates? A record might not seem like a duplicate when selecting all fields, but if might ... if you're only looking at 3 or 4 of them. If that's the problem, you need to modify the query. Otherwise, move on to the output code ..
I have verified the output, and it doesn't include duplicates....only one of each. In fact, if you subscribe to the feed, it will only have one item each, however at a later date it's as if the reader will think all entries are new again, and then include them in the download once more which results in you seeing dupes.
If you're absolutely 100% positive there's no possible way the data could contain duplicates, then it has to be a problem with the reader. But I've no idea what it might be ..