Embed creating duplicate http / https topics


(Sckott) #1

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.


(Rafael dos Santos Silva) #2

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.


(Sckott) #3

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>

(Rafael dos Santos Silva) #4

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


(Sckott) #5

Okay, thanks for your help.


(Sckott) #6

See also Embedding Discourse Comments via Javascript


(Jeff Atwood) #7

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


(Sckott) #8

want me to remove the link?


(Arpit Jalan) #9

This is now fixed via:


(Jeff Atwood) #10