The discussion is about including a category in a topic URL for retargeting purposes. stevenpslade proposed adding the category to the URL, but tobiaseigen suggested that adding more slashes or delimiters would cause problems. Another option is to include the category in the query string, as in https://meta.discourse.org/t/where-can-i-create-tags/31094/?category=support.
Lockie asked how to make a URL of a thread contain its category, and merefield explained that the association with a category is implicit and not needed in the URL. However, Lockie is using a third-party software that infers the category from the URL, making it necessary to include the category.
Suggestions from other users include building a plugin or script to change the URLs, renato suggested using a hack to provide the URLs to the scraper in a specific format, and j127 proposed scraping the JSON version of the topic page to get the category_id field. Heliosurge also suggested using RSS feeds as an alternative. Overall, there is no simple site setting or plugin to achieve this, but several workarounds are proposed.
I’m very much a n00b when it comes to Discourse but also forums in general and I’d like to ask and understand if and how it is possible for a URL of a thread to contain it’s category.
I’m utilising a third party software which scraps a forum. I’m limited to its queries and so when it scrapes a thread (topic) it needs to infer what category it is part of, which it appears to do via the url.
If you’re the one explicitly providing the URLs to the scraper and defining how it’ll extract the category from them, you might be able to use what Tobias suggested as a hack – you could provide it with /t/category-name__topic-slug/topic-id, for example. Discourse will serve a 301 redirect response to the final URL, based solely on the topic-id.
If it gets the URLs during the scraping process, though, it feels like a lot of work for a change aimed only at fulfilling a limitation in the scraping strategy.
Not that I know of. Serving a /t/category-name/topic-slug/topic_id route in a plugin seems doable, but then having an option so all references to topics in Discourse prefer this alternative route seems (to me, personally) like too much work for little gain.