RSS Feed - Duplicate Items

Discussion in 'Programming' started by apmsolutions, May 24, 2010.

  1. #1
    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):

     
    apmsolutions, May 24, 2010 IP
  2. joemar

    joemar Peon

    Messages:
    305
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if you think its being duplicated find some site that will automatically create a feed to your site.
     
    joemar, May 24, 2010 IP
  3. apmsolutions

    apmsolutions Peon

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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.
     
    apmsolutions, May 24, 2010 IP
  4. cfStarlight

    cfStarlight Peon

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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"..?
     
    cfStarlight, May 25, 2010 IP
  5. apmsolutions

    apmsolutions Peon

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If you look at the attachment, you will see what I mean by duplicating.
     

    Attached Files:

    apmsolutions, May 25, 2010 IP
  6. cfStarlight

    cfStarlight Peon

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    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 ..
     
    cfStarlight, May 26, 2010 IP
  7. apmsolutions

    apmsolutions Peon

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    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.
     
    apmsolutions, May 26, 2010 IP
  8. cfStarlight

    cfStarlight Peon

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    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 ..
     
    cfStarlight, May 27, 2010 IP