Create topic if not found

AI-generated summary

xian, new to the forum, seeks a way to automatically create a new topic when a search yields no results, using the search term as the topic title. tvavrda explains that while Discourse doesn’t natively support this, it’s possible to dynamically generate topic creation links using URL parameters. These parameters can pre-fill the topic title, body, category (by name or ID), and tags. For example: https://your-discourse-instance.com/new-topic?title=Topic%20Title&body=Content&category=category/subcategory&tags=tag1,tag2. All text must be URL-encoded. This feature works only for logged-in users. For a fully automated Wikipedia-style “red link” system, custom development would be required. tvavrda also references a prior ask.discourse.com discussion on the topic and notes that embedded comment systems offer similar functionality.

Hello,
I’m new to this forum and looking for help.
I could not find a solution to my specific problem.

I want to be able to add a topic / thread in discourse with a press of a button if it is not found by the search. The name of the topic should be the search term.

Is there something like this already or how would I do that?

Thanks for any help

I thought about that too in order to make something Wikipedia has. So I asked and it seems to me there would be a way, maybe with a little theme that would convert the links leading nowhere to that:

Discourse allows you to create a topic dynamically by constructing a specific URL with parameters. However, it does not directly create topics by clicking on arbitrary non-existing links, unless incorporated via a custom system like the embedded comments setup. Here’s how dynamic topic creation via URL works:

Constructing the URL for Topic Creation

  1. Basic new topic URL:
    Add /new-topic to your site’s URL:
https://your-discourse-instance.com/new-topic

Clicking this will open a blank new topic composer for logged-in users. Non-logged-in users will be prompted to log in before composing.
2. Pre-fill topic fields with parameters:
To include predefined information such as title, body, category, or tags, use additional query parameters:

https://your-discourse-instance.com/new-topic?title=Topic%20Title&body=Topic%20Body&category=category/subcategory&tags=tag1,tag2
  • title: The topic title (URL-encoded, e.g., spaces replaced by %20).
  • body: Content of the topic.
  • category: Specify the category and optional subcategory using /.
  • tags: Comma-separated list of tags.
  1. Optional parameter for category ID:
    Instead of the category name, you can use the numeric category_id. For instance:
https://your-discourse-instance.com/new-topic?title=Topic%20Title&category_id=5
  1. Encoding special characters:
    Ensure all added text parameters are URL-encoded to avoid errors. Tools like the w3Schools URL Encode Decoder can help.

Example

To pre-fill a topic for discussing a WordPress issue:

https://meta.discourse.org/new-topic?title=WordPress%20Issue&body=Please%20describe%20your%20issue...&category=support/wordpress&tags=wordpress

Additional Notes:

  • This approach works only for logged-in users. Non-logged-in users will need to sign in first.
  • Testing links beforehand is advisable to ensure all parameters function as expected.

If you’re looking for a completely automated dynamic linking solution (similar to embedded comments or a Wikipedia-style red link setup), that would require custom development or integration.