Not generate topic automatically for all blog posts

I think that what you want is have all topics that are pulled to Discourse from your website be marked as unlisted. When a topic receives a comment, it would automatically be marked as listed. Unlisted topics do not appear in the topic list, so this would prevent the topic list on your site from being full of topics with no responses.

This type of configuration makes sense for sites where people are accessing Discourse topics by clicking a “Start Discussion” link that is displayed below a blog post. Discourse does not have a setting for this, but I think it would be a reasonable feature request. The DIscourse WordPress plugin has this functionality, but it uses the Discourse API for unlisting and listing the topics.

5 Likes

@simon That’s exactly what we want! Thanks for your reply. The problem is that our site is not built with WordPress. But we can take a look at the Discourse API.

Speaking of feature requests, where can I raise this request for Discourse?

@Canapin So we want the blog post to receive a comment first BEFORE it is listed as a Discourse topic. The post does exist on our site in the first place, doesn’t it?

That’s a good idea. The other option is to not create the topics until the user clicks through but I think your suggestion might be easier. Perhaps @eviltrout could consider this as a possible task for this release, next week?

4 Likes

And how can I set the Unlisted by api,I can’t find the relative apis in my comment embedding.js. Thank you.

The easiest way to figure this out would be to try unlisting and then listing a topic through the Discourse user interface while following the steps outlined in this guide: How to reverse engineer the Discourse API.

To automate the process via the API, you would need to setup a webhook to listen for post events. When you receive a webhook telling you that the first post in your embed category has been created, you would then send an API request to unlist the topic. When you receive a webhook telling you that the second post in a topic has been created, you would then send an API request to list the topic.

As was mentioned above, a better approach might be to have the topic automatically unlisted the first time a user clicks through to the topic from a blog site. That way the first user to leave a comment would not see the topic marked as unlisted. That would be somewhat more complex to setup, but it could be done through the API by listening for click events on links to your Discourse topics.

5 Likes

This has been asked for years on the Embedding Discourse Comments via Javascript topic.

5 Likes

Yeah I think we should do this @eviltrout. At least the easier (default unlisted, once a reply arrives it is listed?) form maybe?

3 Likes

Ok, thanks for your help.

Looking forward to this new feature. Sound like a much-needed one. So how can I keep myself informed when it’s available?

1 Like

Ideally, this topic will get updated when the feature becomes available. In that case, you will get a notification about it if you set your notification level for this topic to Watching.

2 Likes

Okay I’ve got a PR ready for this feature:

https://github.com/discourse/discourse/pull/9391

9 Likes

Good to know! Thanks!

Wow that’s really impressive! So fast.

I just saw this feature live! Shout out to @codinghorror and @eviltrout. Thanks for being so responsive to users’ request.

1 Like

Yes apologies I meant to update this topic to announce it’s now live. Can you try it out and provide feedback?

We’d like to make this the default in the future but we want to make sure it’s been tested properly.

4 Likes

No worries.

Totally.

I have enabled this option and the new blog post has been unlisted automatically.
image

But the old ones are still there and I need to manually delete them.

Is that the right logic according to your design?

2 Likes

Yes, I should have been more clear that this only applies to new imports going forward.

3 Likes

@eviltrout Thanks for clarification. Everything is working properly so far. :grinning:

@eviltrout I went through the process below and found a bug:

  1. Deleted all old posts without any comment - Success
  2. Visited one of the deleted posts on our website - Success
  3. Clicked the Start Discussion button - Success
  4. Comment on the post - Failure becuase the topic is unlisted by default