# How to add custom topic map code?

**URL:** https://meta.discourse.org/t/how-to-add-custom-topic-map-code/288868
**Category:** Development
**Tags:** topic-map
**Created:** [December 15, 2023, 9:32pm UTC](https://meta.discourse.org/t/how-to-add-custom-topic-map-code/288868 "2023-12-15T21:32:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![amotl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/amotl/32/109873_2.png) [@amotl](https://meta.discourse.org/u/amotl)
#### Post date: [December 15, 2023, 9:32pm UTC](https://meta.discourse.org/t/how-to-add-custom-topic-map-code/288868/1 "2023-12-15T21:32:20Z")

</div>

Hi again, I am continuing the discussion from [Show topic-map without a reply](https://meta.discourse.org/t/show-topic-map-without-a-reply/87447/10), because it has been closed. \[1\]

> [@Show topic-map without a reply](https://meta.discourse.org/t/show-topic-map-without-a-reply/87447/10):
>
> There’s some useful info in this post that would help with this:  
> – [How to show topic-map on non-commented posts? - #15 by Don](https://meta.discourse.org/t/how-to-show-topic-map-on-non-commented-posts/204222/15)

That’s super sweet. Thank you, Jammy. May I humbly ask how/where this JavaScript snippet should be applied to make it work?

```javascript
<script type="text/discourse-plugin" version="0.8">
  api.includePostAttributes('topicMap');
</script>

```

* * *

1. a) Why? b) Feel free to refactor and/or re-open, as you see fit.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [December 15, 2023, 9:53pm UTC](https://meta.discourse.org/t/how-to-add-custom-topic-map-code/288868/2 "2023-12-15T21:53:19Z")

</div>

Hi,

You can add it to your theme or in a new theme component HTML.

Usually, in a theme or component (Admin → Customize → Themes), you click on Edit CSS/HTML:

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/c/2/4c21ec3faea0d170e9b63d2da4060cd7c2a96385.png)

Then, you click on Head and you can insert the code there:

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/0/5/405866080dcb7dc0d61a62a210132755af86aada.png)

That’s it! 🙂

---

<div class="post-metadata">

### Author: ![amotl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/amotl/32/109873_2.png) [@amotl](https://meta.discourse.org/u/amotl)
#### Post date: [December 15, 2023, 9:57pm UTC](https://meta.discourse.org/t/how-to-add-custom-topic-map-code/288868/3 "2023-12-15T21:57:30Z")

</div>

Dear Arkshine,

that worked like a charm, thank you. For example, on this post, there have been no comments yet, so we never have been able to know about its pageviews, and other metadata.

> **[Volkov Labs Data Manipulation Panel for Grafana](https://community.panodata.org/t/volkov-labs-data-manipulation-panel-for-grafana/252)**
>
> About The Data Manipulation Form Panel is a plugin for Grafana that can be used to insert or update application data, and modify configuration directly from your Grafana dashboard. Architecture Panel options allow you to specify the URL for GET...

With the improvements implemented by @pmusaraj \[1\], shared by @Don \[2\], and popularized by @JammyDodger, it works like [DWIM](https://en.wikipedia.org/wiki/DWIM). I love it, thank you very much!

* * *

1. [FIX: Don't force show topic map on non-first posts · Pull Request #19302 · discourse/discourse](https://github.com/discourse/discourse/pull/19302) 

2. [How to show topic-map on non-commented posts? - #15 by Don](https://meta.discourse.org/t/how-to-show-topic-map-on-non-commented-posts/204222/15)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [January 14, 2024, 9:57pm UTC](https://meta.discourse.org/t/how-to-add-custom-topic-map-code/288868/4 "2024-01-14T21:57:52Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
