Discourse has supported linking to categories (announcements) and tags (release-notes) for a long time using hashtags (#). With the introduction of Discourse Chat we wanted to be able to link to chat channels with hashtags, which required some overhauling of how the system works to allow for channels to be suggested with autocomplete and also to cook in posts and chat messages. We also decided to take the time to overhaul the design of the autocomplete menu and cooked hashtags.
A summary of the changes included with this overhaul:
The ability to search for chat channels if you have chat enabled
Hashtag search results prioritise exact matches based on the slug, and depending on whether you are using them in a post or a chat message, we prioritise different types of results (e.g. categories are at the top in a post, but channels are at the top in chat)
A distinct icon is shown for each result
A new style for cooked hashtags which include the distinct icon
The new autocomplete results:
The new cooked style for hashtag autocompletion, which closely matches the @mention style.
You can opt-in to using this new version of hashtag autocompletion and cooking by enabling the enable_experimental_hashtag_autocomplete site setting on your Discourse site:
We expect to make this the default in the new year, meanwhile this is still considered an experimental feature, so there are still a few things to fix and refine.
This feature is now enabled on Discourse Meta as well
An update here ā weāve now made this the default for all sites, after making some changes around how the hashtags are cooked. We now also show colours for the icons including the original subcategory styling :
Thanks for noting this, this is a great point. At the very least some aria-labels on each hashtag are in order. I will try to get a commit for this this week.
Old topics wonāt use the new format for tags and categories until the HTML is rebuild. Is there a way to safely rebuild all topics to make the UI consistent? Maybe with rake?
Without bundle exec, seems to work on a production site
root@Canapin-app:/var/www/discourse# rake hashtags:mark_old_format_for_rebake
Finding posts matching old format, this could take some time...
[!] You are about to mark 0 posts containing hashtags in the old format to rebake. [CTRL+c] to cancel, [ENTER] to continue
Done, rebakes will happen when periodical updates job runs.