Not generate topic automatically for all blog posts

AI-generated summary

The discussion revolves around the topic of not automatically generating a Discourse topic for every blog post. Jamie_Liu1 wants to create a topic only when there’s an actual comment on the post.

Canapin suggests that this might be similar to a previous topic on meta Discourse, which involves auto-posting from WordPress to Discourse under certain conditions. However, Jamie_Liu1 clarifies that their website is built with Hugo, not WordPress.

Simon suggests a possible solution: having all topics pulled from the website be marked as unlisted by default, and then automatically listed when a comment is received. Codinghorror agrees that this is a good idea and suggests it as a possible feature request.

Falco mentions that this feature request has been made before, and Codinghorror suggests implementing it, at least in a simpler form.

Eviltrout creates a PR for the feature, and Jamie_Liu1 is excited to see it implemented.

However, there are some issues with the implementation, including the fact that old topics are not affected and that there’s a bug that prevents unlisted topics from being listed when a comment is received. Eviltrout and Jamie_Liu1 work together to troubleshoot the issue, and Eviltrout eventually fixes it.

In the end, Jamie_Liu1 confirms that the issue has been fixed, and thanks Eviltrout for their efforts.

Hey there, is there any way to not automatically create a topic for every blog post we publish on our website yet still keep the discussion section?

I feel it makes more sense to generate a topic automatically as long as there’s a comment on a certain blog post. Currently the logic is that the topic should exist before people can comment.

Thanks in advance!

Is is the same thing that you want to do?

If it is, see:

Thanks for your reply. Yes I did want to trigger post on discourse under certain conditions only.

However, our website isn’t built with WordPress. It’s built with Hugo.

Is there anything we can do to achieve that?

To be clear that we are not using any comment system other than Discourse. So what we want is to create a topic only when there is actually a comment on a post instead of a bunch of empty topics on Discourse like below:

Did I make myself clear?

Is there a setting for this?

Not really… How are users supposed to reply to a topic if it’s not already posted somewhere? Every topic has to start with 0 reply. I guess I’m missing something here :thinking:

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.

@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?

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.

This has been asked for years on the Embed Discourse comments on another website via Javascript topic.

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

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?

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.

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

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

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.