Support creating pre-filled topic links

a question.

I implemented a theme component, it has a button, click to open the new-topic form with pre-filled content, title. like this

https://www.mydomain.com/new-topic?title=${title}&body=${body}

it works nicely, it opens the new-topic form, but if I don’t want to continue, click “Discard”
this does not discard the topic, it saves as a draft instead…
since I clicked on “Discard”, I don’t want to have it as a draft, have to clean the drafts later

wonder if this is expected using this new-topic url ?
is there a way not to save it as a draft if choose to discard it.

thanks.

how to repro:

  1. in a theme component, add a button, its ref is set to the new-topic url as below
const topicBody = `.....`;
const title = "....";

// the url for new a topic
const createTopicUrl = `https://www.mydomain.com/new-topic?title=${title}&body=${topicBody}`;

const createTopicLink = `<span><a href="${createTopicUrl}" rel="noopener noreferrer">new topic</a></span>`;

const meta = `<div>${publisher}${pub_date} ${createTopicLink}</div>`;

const description = `<p>${description}</p>`;

// add the "new topic" button to UI
return `<li class="news-item"><hr><div class="news-title"><a href="${url}" target="_blank">${title}</a></div>${meta}${description}</li>`;
  1. click the “new topic” button, see the new topic form opened with prefilled title and content.
  2. click discard, confirm
  3. check “my posts”, it has a new draft for this discarded new topic..
1 Like

I can’t seem to repro this here on Meta. Does this happen in safe mode? What version is your instance? Thanks.

my instance is version 2026.1.0

using the system buit-in experience to new a topic, if discard, it does not save it as a draft.

my case is, hooked the new-topic url with a button added in a theme component.
not sure why it is different to the built-in experience…

1 Like

hey, Nate
copilot explained this below,
if this is true, wonder if could have an argument in the url to prevent this, that will be great
say &auto_save=false
thanks for your help.

Yes, that is expected in Discourse. Opening the composer via the new-topic URL (with prefilled title/body) creates a draft as soon as the composer is initialized. Even if you click “Discard” and confirm, Discourse may still keep a draft entry for that route so the content can be restored later. That behavior comes from the core composer/draft autosave logic, not your URL format.

If you want to avoid drafts, you’d need a custom approach (e.g., open a modal, copy to clipboard, or call the composer API with draft-key overrides), but the plain new-topic URL will always engage draft autosave.

I’m not sure if that’s accurate :person_shrugging: . I cannot repro this on safe mode here on Meta. I believe you are on the stable/ESR version for your forum?

hey Nate, yes, I am not sure about that answer from gemini either.

interestingly, I cannot repro it anymore today.
my theme component has no change in that part tho.

thanks for your help, will post if more findings…

1 Like