Discourse Watch Category Button

:discourse2: Summary Watch Category Button adds a marker span that becomes a “Watch this category” button in posts.
:hammer_and_wrench: Repository https://github.com/pacharanero/discourse-watch-category-button
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

:information_source: This theme component uses the logged‑in user’s session to update category notification levels; no API keys are required.

Features

  • Add a “Watch this category” button inside posts using a sanitizer‑safe span.

  • Clicking the button sets the current user’s category notification level to Watching for either the current category or one selected by CategoryId.

  • Only posts authored by allowed groups (default: staff) are transformed into buttons (this is to reduce the chance of this TC being misused to make people watch categories by misrepresentation).

  • Supports targeting a specific category ID or the current post’s category.

  • Hooks into existing Discourse Watching notifications functionality, doesn’t change how Watching status is otherwise managed by a user in their preferences, per-Category, or in email notification Unsubscribes.

Usage

Set a specific category

<span data-watch-category="3">Watch this category</span>

Use the current post’s category

<span data-watch-category="current">Watch this category</span>

Result:

Settings

This component does not include theme settings yet. That’s next, once I have made sure there are no major bugs and that this TC is of some use to other people.

Security and privacy considerations

  • These buttons can only be created by Staff users (at the moment)
  • Requires an explicit user click to change notification settings.
  • No API keys are used; it relies on the logged-in session.

Roadmap ideas

  • Make the groups who can create buttons configurable via theme settings.
  • Make the button style configurable via theme settings.
  • Make the Notification Level configurable (e.g., Tracking, Watching, Muted).

Contributing

I’m happy to accept contributions! Please open issues or pull requests on the GitHub repository. Ideally let’s improve this component rather than forking it to change the ALLOWED_GROUPS or other minor changes.

:discourse2: Summary Watch Category Button adds a marker span that becomes a “Watch this category” button in posts.
:eyeglasses: Preview Add screenshot/GIF here
:hammer_and_wrench: Repository https://github.com/pacharanero/discourse-watch-category-button
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

:information_source: This theme component uses the logged‑in user’s session to update category notification levels; no API keys are required.

Features

  • Add a “Watch this category” button inside posts using a sanitizer‑safe span.
  • Clicking the button sets the current user’s category notification level to Watching.
  • Only posts authored by allowed groups (default: staff) are transformed into buttons.
  • Supports targeting a specific category ID or the current post’s category.

Usage

Set a specific category

<span data-watch-category="3">Watch this category</span>

Use the current post’s category

<span data-watch-category="current">Watch this category</span>

Settings

This component does not include theme settings yet. To change who can create buttons, edit:

  • ALLOWED_GROUPS in javascripts/discourse/api-initializers/theme-initializer.gjs

Notes

  • Requires an explicit user click (no silent changes).
  • The change mirrors the native category notification menu behavior.
  • Category page header updates on next visit without a full page refresh.

Related topics

In researching whether this TC had already been made, I found a few topics requesting similar functionality:

Change notification level with a link
Can I create a link to subscribe to a category? - #3 by david
Make watching a category more prominent for users
Notification setting button with context

3 Likes