# Remove Parent Category from Inline Category Mentions

**URL:** <https://meta.discourse.org/t/remove-parent-category-from-inline-category-mentions/413795>\
**Category:** Theme component\
**Tags:** mentions\
**Created:** [October 2, 2026, 1:57pm UTC](https://meta.discourse.org/t/remove-parent-category-from-inline-category-mentions/413795 "2026-10-02T13:57:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![putty](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/putty/32/370902_2.png) [@putty](https://meta.discourse.org/u/putty)\
**Post date:** [October 2, 2026, 1:57pm UTC](https://meta.discourse.org/t/remove-parent-category-from-inline-category-mentions/413795/1 "2026-10-02T13:57:46Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Summary** | Removes parent category from inline mentions |
| 🛠 | **Repository** | [GitHub - dereklputnam/discourse-inline-category-mentions-no-parent: Discourse theme component: strips the parent category name from inline #category hashtag mentions · GitHub](https://github.com/dereklputnam/discourse-inline-category-mentions-no-parent) |
| ❓ | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |
| 📖 | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

> ‼ I realize this is very likely [covered in these changes](https://meta.discourse.org/t/category-hashtag-floating-cards-and-subcategory-hashtag-display-improvements/412529/1), but not sure if the inline updates are tied to hover cards being enabled.

# Short description

Clean up your inline category mentions by removing the parent category. Includes an option to exclude specific categories (and keep the parent category).

Effect is applied in:

- Category mentions in posts
- The live preview pane in the composer
- The `#` mention autocomplete dropdown in the composer

# Screenshots

## Before

 ![CleanShot 2026-10-02 at 09.46.15](https://global.discourse-cdn.com/meta/original/4X/c/f/e/cfe4be3b958624e62831b2bdb3259daffc0b7e0e.png)

## After

 ![CleanShot 2026-10-02 at 09.45.04](https://global.discourse-cdn.com/meta/original/4X/1/8/1/1817edd7d4278ec814852b7bb6dcda27d0292d93.png)

## With category excluded

 ![CleanShot 2026-10-02 at 09.50.37](https://global.discourse-cdn.com/meta/original/4X/8/9/e/89e428f527c03d421540d82d6bc4e6ff9e833acb.png)

 ![CleanShot 2026-10-02 at 09.55.28](https://global.discourse-cdn.com/meta/original/4X/e/e/d/eed66ddc419f2c2cca043f7be145ca5febcdd48d.png)

---

<div class="post-metadata">

**Author:** ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)\
**Post date:** [October 2, 2026, 3:06pm UTC](https://meta.discourse.org/t/remove-parent-category-from-inline-category-mentions/413795/2 "2026-10-02T15:06:48Z")

</div>

Thanks for sharing. I think it will be fixed on Discourse, in the meantime it’s a functional workaround.

Something important to mention is that the component uses `MutationObserver` and it is a practice [that is suggested to avoid](https://meta.discourse.org/t/how-can-i-set-disable-markdown-default-to-rich-text/370335/3).

---

<div class="post-metadata">

**Author:** ![putty](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/putty/32/370902_2.png) [@putty](https://meta.discourse.org/u/putty)\
**Post date:** [October 2, 2026, 3:38pm UTC](https://meta.discourse.org/t/remove-parent-category-from-inline-category-mentions/413795/3 "2026-10-02T15:38:24Z")

</div>

Thanks, I’ll look into an alternative approach!

---

<div class="post-metadata">

**Author:** ![putty](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/putty/32/370902_2.png) [@putty](https://meta.discourse.org/u/putty)\
**Post date:** [October 2, 2026, 4:29pm UTC](https://meta.discourse.org/t/remove-parent-category-from-inline-category-mentions/413795/4 "2026-10-02T16:29:58Z")

</div>

Thanks again for the heads-up on the observer. I was unaware it’s not recommended.

I removed it everywhere except the composer (the live preview and the # dropdown), since no hook is available for those. And instead of watching the whole page, each one now just watches its own little area.

If a Discourse update ever changes things and it stops working, the composer would just show the full “Parent \> Child” name like it normally does. 🙂

---

<div class="post-metadata">

**Author:** ![satonotdead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/satonotdead/32/447830_2.png) [@satonotdead](https://meta.discourse.org/u/satonotdead)\
**Post date:** [October 2, 2026, 5:00pm UTC](https://meta.discourse.org/t/remove-parent-category-from-inline-category-mentions/413795/5 "2026-10-02T17:00:50Z")

</div>

> [@putty](#):
>
> Thanks again for the heads-up on the observer. I was unaware it’s not recommended.

Oh, thank you for taking it into consideration! Being honest I was aware about it when starting to vibe code into Discourse and then Sam confirmed it.

Fortunately there are almost always different approaches to take, so plugins and theme components are aligned with the suggested practices and can be easily maintained.

I will use your TC because I really want this new feature working as expected 👌
