Minor Original Entry URL Click Count Bug when using /post API

(Chun) #1

We are using Discourse as a Comments System to our dynamic pages and it is working great.

Original main site entry page:

Auto-generated Discourse comments page:

The bug we are currently trying to solve but have gotten stuck with is that due to our setup the original entry URL shows a click count before and after the original entry URL, so 2 times instead of the original 1 time:

To create an embedded topic timely, we wrote a script to call the /post API when we add a new page to our main site and this is working fine.

As the page content of our main site often changes, we are using the ‘Import posts via RSS/ATOM’ function to keep the content of the auto-generated Discourse post up to date.

Below is a sample of our XML code:

<item id="H00006475">
How-To: Install a Philips Hue A19 Bulb (Color) (via iOS)
Please feel encouraged to add comments to <a target='_blank' href='http://www.smarthomedb.com/product/philips-hue-a19-bulb-(color)/how-to/p104/how-to-install-a-philips-hue-a19-bulb-(color)-(via-ios)/h6475'><b>this how-to guide</b></a>!<br/><br/>#h6475<br/>[ Author: <a href='http://community.smarthomedb.com/users/chunliew/activity' target='_blank'><b>Chun Liew</a></b> ]<br/>[ Difficulty: Easy ]<br/>[ Steps: 9 ]<br/><br/>Required Product:<br/>+ [ <a target='_blank' href='http://www.smarthomedb.com/product/philips-hue-a19-bulb-(color)/p104'><b>Philips Hue A19 Bulb (Color)</b></a> ]<br/><br/>Required App:<br/>+ [ <a target='_blank' href='http://www.smarthomedb.com/app/philips-hue/android/a101'><b>Philips Hue</b></a> ]<br/>
<![CDATA[ chunliew ]]>

We found out that after Discourse loads the XML file it inserts an <a> tag prior to the original <a> tag.

Source code after the API is called to create a new embedded topic:

<small>This is a companion discussion topic for the original entry at <a href="http://www.smarthomedb.com/product/philips-hue-a19-bulb-(color)/how-to/p104/how-to-install-a-philips-hue-a19-bulb-(color)-(via-ios)/h6475">http://www.smarthomedb.com/product/philips-hue-a19-bulb-(color)/how-to/p104/how-to-install-a-philips-hue-a19-bulb-(color)-(via-ios)/h6475</a></small>

1 hour later, after Discourse has loaded the XML feed file and updated the post:

<small>This is a companion discussion topic for the original entry at <a href="http://www.smarthomedb.com/product/philips-hue-a19-bulb-(color)/howto/p104/how-to-install-a-philips-hue-a19-bulb-(color)-(via-ios)/h6475"></a><a href="http://www.smarthomedb.com/product/philips-hue-a19-bulb-(color)/how-to/p104/how-to-install-a-philips-hue-a19-bulb-(color)-(via-ios)/h6475">http://www.smarthomedb.com/product/philips-hue-a19-bulb-(color)/how-to/p104/how-to-install-a-philips-hue-a19-bulb-(color)-(via-ios)/h6475</a></small>

Any suggestions with regards to how the above minor original entry URL click count bug could be solved would be highly appreciated.