# Topic ID as a variable?

**URL:** <https://meta.discourse.org/t/topic-id-as-a-variable/374168>\
**Category:** Development\
**Created:** [July 14, 2025, 6:48pm UTC](https://meta.discourse.org/t/topic-id-as-a-variable/374168 "2025-07-14T18:48:32Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [July 14, 2025, 9:01pm UTC](https://meta.discourse.org/t/topic-id-as-a-variable/374168/9 "2025-07-14T21:01:34Z")

</div>

> [@tknospdr](#):
>
> You cannot currently search Discourse by topic id.

You don’t need to search:

`/t/-/id` – but really `/t/id` works.

> [@tknospdr](#):
>
> 'Hey search for bug #138 and let me know what you think."

They can just type `/t/138` and not have to search. But if you are talking to a person, wouldn’t saying "search for bug about “some words they know” make more sense to use in conversation than a number?

> [@awesomerobot](#):
>
> It will be easier to create a custom component that appends this to the correct posts rather than filling a template.

And that was going to be my other suggestion.

I think I’d have used `renderInOutlet` rather than `decorateCookedElement`, but that’s probably because I don’t fully understand decorateCookedElement.

But this will don’t let you search for a bug/topic by topic\_id.

---

_[View the full topic](https://meta.discourse.org/t/topic-id-as-a-variable/374168)._
