# Modernizing inline script tags for templates & JS API

**URL:** https://meta.discourse.org/t/modernizing-inline-script-tags-for-templates-js-api/366482
**Category:** Development
**Tags:** dev-news
**Created:** [May 19, 2025, 9:55am UTC](https://meta.discourse.org/t/modernizing-inline-script-tags-for-templates-js-api/366482 "2025-05-19T09:55:17Z")
**Posts on this page:** 1
**Showing post:** 36

<div class="post-metadata">

### Author: ![cogdog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cogdog/32/116536_2.png) [@cogdog](https://meta.discourse.org/u/cogdog)
#### Post date: [September 10, 2025, 7:13pm UTC](https://meta.discourse.org/t/modernizing-inline-script-tags-for-templates-js-api/366482/36 "2025-09-10T19:13:31Z")

</div>

As a poke and guess admin I was a bit worried reading this, but when I checked my custom theme, I saw only a very simple script:

```plaintext
<script type="text/discourse-plugin" version="0.8.11">

// icon substitutions for share buttons
api.replaceIcon('d-post-share', 'up-right-from-square');
api.replaceIcon('d-topic-share', 'up-right-from-square');

</script>

```

So it was just a copy of whats between the script tags, hop to the JS tab, and there was a place to slap it in. That was easy!

```plaintext
import { apiInitializer } from "discourse/lib/api";

export default apiInitializer((api) => {
	// icon substitutions for share buttons
	api.replaceIcon('d-post-share', 'up-right-from-square');
	api.replaceIcon('d-topic-share', 'up-right-from-square');
});

```

---

_[View the full topic](https://meta.discourse.org/t/modernizing-inline-script-tags-for-templates-js-api/366482)._
