Adding tags to topics created with Discourse Embed feature?

AI-generated summary

Adding tags to topics created with Discourse Embed feature

jordan-violet is looking to add tags to topics created with the Discourse Embed feature, which will be used in different areas of their MKDocs site documentation.

The goal is to have one embed for all documentation pages, but with different tags for each doc. For example, /docs/doc1 would have a #docs and #doc1 tag, while /docs/doc2 would have a #docs and #doc2 tag.

pfaffman suggests using the Discourse Automation plugin or a custom plugin to achieve this. The tag could be determined by parsing the URL of the embedded location.

pfaffman reiterates that an automation or custom plugin would be necessary to add tags to the topics, using the URL to determine the tag.

Is it possible to add tags to topics that are created with the Discourse embed feature to embed comments on other pages?

We want to embed Discourse in different areas of our documentation, and depending on the area that it is embedded, add different tags to those topics.

If it matters (or if anyone has any other thoughts on this), this would be done in an MKDocs site.

What is an “area?” The embed setup posted topics in a single category.

Discourse Automation might help? It has a script to add a tag, so maybe it can help. Or maybe you’d need to do something with the API to move the topics, or have a plugin that used add_model_callback(Topic, :after_create) to identify the new topics from your site and re-tagged them.

Great clarifying question!

So it would be one embed for all documentation pages, but embeds in different docs would, ideally, have different tags. For example, the following docs structure:

  • /docs (discourse category: #docs-feedback, tag: docs)
    • /docs/doc1 (discourse category: #docs-feedback, tag: #doc1)
      • /docs/doc1/item1 (discourse category: #docs-feedback, tag: #doc1)
      • /docs/doc1/item2 (discourse category: #docs-feedback, tag: #doc1)
    • /docs/doc2 (discourse category: #docs-feedback, tag: #doc2)
      • /docs/doc2/item1 (discourse category: #docs-feedback, tag: #doc2)
      • /docs/doc2/item2 (discourse category: #docs-feedback, tag: #doc2)

I think I understand. If you want them tagged, you’d need to do that with the automation plugin or a custom plugin as I suggested before. I guess you’d get the tag by parsing the URL of the place it’s embedded.