# Using scripts in the topic

**URL:** https://meta.discourse.org/t/using-scripts-in-the-topic/294873
**Category:** Development
**Created:** [February 9, 2024, 6:47pm UTC](https://meta.discourse.org/t/using-scripts-in-the-topic/294873 "2024-02-09T18:47:50Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Gonerdot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gonerdot/32/366307_2.png) [@Gonerdot](https://meta.discourse.org/u/Gonerdot)
#### Post date: [February 9, 2024, 6:47pm UTC](https://meta.discourse.org/t/using-scripts-in-the-topic/294873/1 "2024-02-09T18:47:50Z")

</div>

How can i implement the use of javascript in topics?

---

<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: [February 9, 2024, 7:08pm UTC](https://meta.discourse.org/t/using-scripts-in-the-topic/294873/2 "2024-02-09T19:08:31Z")

</div>

In a theme component.

But if you want users to be able to put javascript in topics, it’s a bad idea and you can.

Can you say more about what it is you’re trying to accomplish?

---

<div class="post-metadata">

### Author: ![Gonerdot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gonerdot/32/366307_2.png) [@Gonerdot](https://meta.discourse.org/u/Gonerdot)
#### Post date: [February 9, 2024, 7:12pm UTC](https://meta.discourse.org/t/using-scripts-in-the-topic/294873/3 "2024-02-09T19:12:26Z")

</div>

> [@pfaffman](#):
>
> Can you say more about what it is you’re trying to accomplish?

I want to add javascript code to specific topics.  
This code calls an ad unit from the ad network I’m working with.  
Therefore, it is necessary to install it in specific places, and not just through a component, since there the choice is only between Body and Footer.

I tried using House Ads from the advertising plugin, but it doesn’t support JS

---

<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: [February 9, 2024, 9:02pm UTC](https://meta.discourse.org/t/using-scripts-in-the-topic/294873/4 "2024-02-09T21:02:19Z")

</div>

Look at the topics about how to develop themes. Also check out the [Plugin outlet locations theme component](https://meta.discourse.org/t/plugin-outlet-locations-theme-component/100673) to see where you can insert stuff.

---

<div class="post-metadata">

### Author: ![Gonerdot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gonerdot/32/366307_2.png) [@Gonerdot](https://meta.discourse.org/u/Gonerdot)
#### Post date: [February 9, 2024, 10:19pm UTC](https://meta.discourse.org/t/using-scripts-in-the-topic/294873/5 "2024-02-09T22:19:50Z")

</div>

> [@pfaffman](#):
>
> Also check out the [Plugin outlet locations theme component](https://meta.discourse.org/t/plugin-outlet-locations-theme-component/100673) to see where you can insert stuff.

Looks interesting, but my knowledge is not enough to understand how to use it 😅

Can you tell me how to insert the necessary code here?

 ![image](https://global.discourse-cdn.com/meta/original/4X/1/7/d/17deeecd2356beb4a6d098a55530056b139be79d.png)

---

<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: [February 9, 2024, 10:21pm UTC](https://meta.discourse.org/t/using-scripts-in-the-topic/294873/6 "2024-02-09T22:21:05Z")

</div>

Maybe this will help: [Add custom content that only appears on your homepage](https://meta.discourse.org/t/add-custom-content-that-only-appears-on-your-homepage/131415)

But you’ll need to have a look at the theme development tutorial.

---

<div class="post-metadata">

### Author: ![Gonerdot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gonerdot/32/366307_2.png) [@Gonerdot](https://meta.discourse.org/u/Gonerdot)
#### Post date: [February 9, 2024, 10:25pm UTC](https://meta.discourse.org/t/using-scripts-in-the-topic/294873/7 "2024-02-09T22:25:39Z")

</div>

It’s too difficult for me. Looks like we’ll have to put this off for later for now. 🥲

---

<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: [March 10, 2024, 10:26pm UTC](https://meta.discourse.org/t/using-scripts-in-the-topic/294873/8 "2024-03-10T22:26:23Z")

</div>

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