Embed discourse topic but do not automatically create

I would like it so the topic is only created by the RSS feed, and not by the embed. If the embed cannot find an associated topic, then it does not display anything (the message saying topic is being generated would be done on my site, not through discourse). Is this possible?

Originally I was hoping to use the discourse API to find a topic by the discourseEmbedUrl and if the topic exists then use that ID to display the comments, however this doesn’t seem to be possible with the API.

2 Likes

Hey, good question and something I’ve looked into a bit as well! Not totally following re: the RSS thing but it sounds like you may be looking for something along the line of what’s been discussed here? —

The short answer seems to be: not yet possible out of the box, and kind of tricky, but would be feasible to build as custom functionality.

Currently there is a way to create topics via the WP Discourse plugin where the topic is created and linked to the WordPress post, but unlisted on Discourse until it gets at least one reply. (Not sure if that may be relevant for you, but a cool partial solution for this kind of thing!)

I see there’s also some discussion here w/ about possibly implementing either as PR or plugin but not clear if it went anywhere:

Maybe @joebuhlig can chime in! Personally I would be interested in this sort of thing for the use case of enabling Discourse commenting for thousands of WP posts without first having to have all the topics created in Discourse. I’m sure a more general solution for embeds could be useful for lots of scenarios.

4 Likes

Hey, Andrew! If you look at the second link that @bts shared you’ll see the expected path for this. But the best I know is that it doesn’t exist to date.

1 Like

Hey Brendan,

Sorry for the confusion about the RSS feed. Pretty much we have an RSS feed that is crawled every 5 minutes by Discourse to create topics for entries on our site. This creates the topics on our Discourse with the appropriate title and description. However, if someone were to visit the page for that entry after the entry was added but before our RSS feed was crawled again, then Discourse would automatically generate a topic and then display it. This would normally be fine, but in our case this will not generate a topic with the correct title, so we would like the Discourse topic to only show existing topics and not create one if it does not exist for the current entry. From my searching this seems to only be possible if you reference the topicID of a topic.

I do like the idea of only creating a thread if a user decides to create one, as this would keep our Discourse site less cluttered.

It seems that for my use case, it might be easier to fix the issue I mentioned above on my side (title not generating properly).

Thanks for the response. Cheers!

1 Like