The discussion revolves around the limitation of tag functionality in Discourse. Dan_Beter explained that when a tag is added to a reply post, it does not populate in the search bar or trigger notifications. This issue makes it difficult for their team to track topics that need documentation updates.
Canapin and Jagster clarified that tags can only be added to topics, not posts. However, Dan_Beter pointed out that referencing a tag in a post is possible using a hashtag.
JammyDodger suggested using the Data Explorer plugin to query posts that reference a specific tag. They provided a sample SQL query to achieve this.
Dab_Beter expressed gratitude for the workaround and also explored using Watched Words to auto-create tags. However, they noted that this feature only works for topics. They suggested that allowing tags on posts, with an optional toggle setting, would be helpful for their specific use case.
We use Discourse as a knowledge & feedback sharing forum for our employees, partners, and customers. We’ve communicated to everyone that they should add a docrequest tag to a Topic or Post if a community conversation uncovers a topic for which we need to add or improve our documentation; our product team, in turn, has set their watching preferences to be notified any time the docrequest tag is used.
What we are finding is that the tag neither populates in the Search bar nor in tracking notifications if the tag is used in a reply post - it only ever works if it’s added to the original Topic. I, as the community moderator and admin, then need to monitor every post for the tag and then manually add the tag to the original topic. This obviously does not scale.
Am I doing something incorrectly or is there a setting I can change?
You can reference a tag in a post, but only a topic can actually be tagged as such.
However, if you have the data explorer plugin you could use a query something like this to pull up a list of ones where the tag has been linked in a post:
-- [params]
-- string :hashtag
-- date :start_date
-- date :end_date
WITH target_posts AS (
SELECT
p.id AS post_id,
t.category_id,
p.created_at
FROM posts p
JOIN topics t ON p.topic_id = t.id
JOIN users u ON u.id = p.user_id
WHERE t.deleted_at IS NULL
AND t.archetype = 'regular'
AND p.deleted_at IS NULL
AND p.post_type = 1
AND p.created_at::date BETWEEN :start_date AND :end_date
AND p.post_number <> 1
)
SELECT
tp.category_id,
tp.post_id,
tp.created_at::date
FROM target_posts tp
LEFT JOIN post_search_data psd ON psd.post_id = tp.post_id
WHERE psd.search_data @@ TO_TSQUERY(:hashtag)
ORDER BY tp.created_at DESC
Thank you. Without an easy button, that will have to do. I’ve also gone in and added Watched Words to auto-create the tag if needed, but again, I think that only works for Topics. It would be great if there was a way to add tags to Posts - perhaps most folks would find that a bit much, but if it was a setting that could be toggled on, I know it would sure help at least our scenario. Anyway, thanks for the info, all!