Embed creating duplicate http / https topics

First, thanks for Discourse - awesome product.

I’m using embed in this category Blog - rOpenSci Discuss for comments on our blog at rOpenSci | Blog

After first implementing the embed, it worked great. Recently, our forum has been creating duplicate topics (which I try to quickly delete to minimize annoying our users). Any thoughts on why duplicate topics are showing up?

I wonder if it’s at all related to how we make our site. We use Jekyll, render locally, then push to a server. I wonder if something about the way we update our site makes our forum think there’s a new topic to create even though the blog post linked to that topic is already linked to a topic already created.

Maybe there’s a way to prevent duplicate topics from being created as a work-around?

p.s. Duplicates were just created for three blog posts (the top 3 here Blog - rOpenSci Discuss ) Duplicates seem to be created every few hours now.

It’s one for the http and one for the https version of the blog.

I believe if you add proper redirects (http sends 301 to https + HSTS headers) it won’t happen.

4 Likes

Makes sense, yep, ropensci.org still allows both http and https without redirecting http to https

Is there a way to in the meantime to make a fix in the embed code? Like only create a topic for https version of the URL? I have https hard-coded below, but I guess that doesn’t do it?

this is the code we have now:

<script type="text/javascript">
  DiscourseEmbed = { discourseUrl: 'https://discuss.ropensci.org/',
                     discourseEmbedUrl: 'https://ropensci.org{{ page.url }}' };

  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();
</script>

I think it’s easier to fix the redirects than to find why our embed code is ignoring the discourseEmbedUrl somewhere.

3 Likes

Okay, thanks for your help.

See also Embedding Discourse Comments via Javascript

That is not the same issue, that is about the “Show full post” button not duplicate topics.

want me to remove the link?

This is now fixed via:

https://github.com/discourse/discourse/commit/9030d3ef6316431da2e070d1449acb90da57c4b8

6 Likes