Title of topic does not resolve from a URL given to "title=" param when composing a topic via "/new-topic" API


(Daler) #1

I’m not sure if this is a bug with Oneboxing when Starting a topic with a URL or if this is a matter with how Composing a new pre-filled topic via URL works. Both topics are now closed, so here we go:

Expected:

When a URL is passed to the title= param it should get queried and return a valid title-text in the Title field and a featured image (if supported by source page at that URL).

What I observe:

I make a get request to <my-site>/new-topic? endpoint with the following params:

title=window.location (a valid URL gets passed into the Title input field)
category=myCategory (a category gets correctly selected in the category selector)
body=Some_Markdown_Text (correctly formatted markdown appears in Composer’s textarea)

The problem:

The URL doesn’t seem to get queried and stays as an ugly title when the Create topic button is pressed.

Any thoughts on this @neil @techAPJ ?


(Neil Lalonde) #2

You’re probably the first person to try that. It should work as you expect.


(Daler) #4

I agree, but does it actually work for you? Here’s a demo to try right on meta.discourse.org :slight_smile:


(Kane York) #5

Note also that it won’t resolve a pasted URL if there’s already body content.

That could be added as defined behavior for a new-topic URL.


(Arpit Jalan) #6

Fixed via:

It won’t work if body parameter is present, as @riking mentioned. Updated the feature topic with example.

Thanks for bringing this in our notice @dalerka :+1:


(Daler) #7

Thanks, but would it be possible to make it work when the body parameter is present?
I found a good use case and made a bookmarklet to help users share content from the web to forum. Appreciate your help!


(Arpit Jalan) #8

No it won’t be possible because the original feature does not support that.


(Daler) #9

Well, since I cannot post in that topic, perhaps @neil can help support this use case? I believe many forum owners and users could benefit from such functionality.


(Neil Lalonde) #10

Why doesn’t your bookmarklet send the title instead of the url, and then it can send the body with the url on one line so it oneboxes where you want it, along with custom body text? You don’t need to use the “paste a link into the title” feature for this.


(Daler) #11

Thanks for suggestion! I tried and oneboxing works. However the original source domain doesn’t get inserted under the Title field after submission of a new topic. :cry:

It would be great to see automatic attribution and the source domain in the Topic list view (like on Reddit and HN). Also it would help users to quickly spot source domains which may be abusing/spamming etc. when looking at the list of recent topics.


(Arpit Jalan) #12

This topic was automatically closed after 18 hours. New replies are no longer allowed.