Drupal Embed: Create Blank Topic Without Duplicating Content

Hi there,
We use Discourse embedded into Drupal article pages. Every time someone from a Drupal article clicks to add a comment, a topic is automatically created within Discourse, and the article’s text is duplicated into the Discourse topic.

Is it possible to still have the Discourse create a topic, but without duplicating the article’s text within the new topic?
If it helps, the Discourse embed code we use is below:

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

On your Admin / Customize / Embedding page, is the “Truncate the embedded posts” checkbox checked? When that setting is enabled, Discourse will only pull in an excerpt of the post instead of pulling in the full post content. Users will need to click the “Show Full Post” button to read the full post on Discourse. If your concern is about being penalized for duplicate content, only embedding an excerpt instead of the full post should improve things.

3 Likes

Thanks so much for posting this, and my sincerest apologies for the months between then and now! I have been meaning to ask further about this.

Is it possible to not to even show a preview of the article on Discourse, and instead, display a message that simply states something like:
“This is the commenting thread for [title of article], which can be read at [link to article on our website].”

We’re hoping to have a way to lead users to the full article, but also reduce the risk that readers might only skim the preview, and jump to posting their thoughts and opinions on only what they read – instead of taking time to read the full article first.

1 Like

I do not think that there is a way to prevent the post’s excerpt from being displayed on Discourse when the javascript embed code is used to publish posts to Discourse. What you are wanting to do is achievable when publishing posts from an external site to Discourse via the API. For example, this could be easily done from a WordPress site that publishes posts to Discourse with our WordPress plugin. Possibly you could achieve something similar with a Drupal Discourse module. This module looks promising: https://www.drupal.org/project/discourse_comments.

2 Likes

Simon, thank you for this! I checked out the discourse_comments module, but it seems like it’s for Drupal 8 only. I’m not sure if there is any functionality that would allow this to work similarly in Drupal 7 as well?

I’m fairly sure there are some Drupal Discourse modules that support Drupal 7, but I’m not sure if they are being actively maintained.