New topic URL format

Is there a way to predict the URL that will be generated when a new topic is created so long as you have the thread title?

Reason I ask, I have a wizard setup that creates a new topic after it is complete. Based on user input into fields, the title of the thread will always follow a the specific format.

Here’s the odd deal. Rather than using DiscoTOC (we have reasons), POST 1 in the topic contains a bunch of information, but also has a topic a Table of contents. The topic will ALWAYS be 8 replies ling and each of them will use a canned response to create the “title” of each reply, (1-7). I have the wizard generating the Title with a blank hyperlink to each reply, IE.


[1. Meeting Agenda](/2)
[2. Meeting Files](/3)
[3. In meeting votes](/4)
[4. Meeting Minutes - [Initial Draft] Preliminary for feedback](/5)
[5. Meeting Minutes - [Final Draft] Consideration for distribution](/6)
[6. Meeting Minutes  - [Distribution Copy] Vote to accept meeting minutes](/7)
[7. Reserved](/8)

The reason I ask is once the wizard creates the topic, it leaves my user with this list for a TOC (always the same in this category, every month). My user must copy the URL to the topic, then paste it in ahead of the/Reply# because the way it Discourse generates a topic’s URL has the thread number (dynamic) at the very end of the URL. With the wizard, I can generate the syntax of the entire URL, minus the topic ID.

Is there a way to generate a URL before the topic is created (so no topic ID yet) that Discourse ignores a missing topic ID but still links properly to the topic. This would be immensely useful in this case, and I suppose some other use cases to use wizards to auto generate links within a new topic being created.

1 Like

Why doesn’t the wizard reads the response from the create topic call, which contains the newly created topic URL, and returns that to your user?

2 Likes

I’m not sure how the wizard that is running before the topic is created which can capture the upcoming generated URL and insert it within the wizard’s composer…

Maybe have the wizard create the topic first, so it can get the ID an then edit it wth the information you want?

Yea, I’m just trying to eliminate the manual step for the user who has to maintain a records system but idiot proofed for persons not comfortable with more than very basic markdown.

The problem is the person responsible is not hired or assigned based on merit, it’s a membership election that puts them in the position and it is a specific elected position that is tasked with it. As it is now, it’s just tossing a word doc in a Dropbox folder each month. This is a little bit of a learning curve in transitioning to discourse for some of our library style and public record keeping

Hence doing my best to take the need for the user to do more than complete a wizard each month

Then maybe do it with the API? I dont’ fully understand the issue, but it seems like you have a chicken/egg problem. You can usually use just the slug without the topic ID lke https://meta.discourse.org/t/new-topic-url-format , so maybe that’ll work.

Nail on head Jay… you hit it

I guess it boils down to is that the wizard is already responsible for creating the thread title, thus the URL can be entirely predicted except for the topic ID. So is there a way discourse will direct a user to a topic if the URL doesn’t contain the topic ID, or is there any rule via a custom plug-in that allows discourse to ignore the topic ID provided the entirety of the url matches minus the topic ID…

I think that if the slug is unique and it doesn’t start with a number it should work without the topic_id.

It does, but it’s impossible to snap to a specific reply with the last /reply#

Cause it’s domain/title/postID/reply#

Trying to figure out a way to direct to the reply without or using some generic placeholder in the postID field