How to add%{post_url} in customize URL

hello everyone,

I would like to know if it is possible in a URL to put the post_url of the message from which it was clicked ?

Basically I would like to click on a url which open a new subject in a category with in the body of the message the url of the current post.

I manage to open a new topic in the right category with this message. Compose a new pre-filled topic via URL

it must surely be with %{post_url}

I just have to add the URL of the starting post.

Thanks for avance.

It sounds like you are trying to achieve something similar to the Discourse “Reply as linked topic” functionality. Users can do that by selecting that option from the composer’s reply-options menu:

You could also achieve that by using the compose topic via URL method that you have linked to. To get that to work, you will need to urlencode the topic’s URL before adding it to the body section of the URL. For example, if you wanted to create a link that added this topic’s URL (https://meta.discourse.org/t/how-to-add-post-url-in-customize-url/176935) to the body of a new topic, you would need to urlencode it to https%3A%2F%2Fmeta.discourse.org%2Ft%2Fhow-to-add-post-url-in-customize-url%2F176935 before adding it to the URL’s body section.

If you use that method, you will probably find that you need to URL encode the other parts of the URL to remove any spaces in it’s title. Otherwise it will not create a clickable URL.

Oh ok thanks.

It’s not possible with a same link with variable ?

No, there is not a way to substitute a link into a post_url variable. Possibly something that did that could be developed as a theme component or a plugin.

1 Like

Very thanks for this information

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.