how to reuse my code within embedded HTML components?

On various pages of my site, I am embedding an HTML component in which I put a google map to display a bunch of locations from my database. Every time I embed this HTML component in a page, i have to paste in the same code (to initialize the map, format it, add the data, etc). This is especially bad when i need to change the code as then I have to re-paste it into every HTML component. There are small differences across components, such as map zoom level, but the core code is the same and should be re-used.

My question is, how can I let my HTML see the code i want to reuse?

For instance, is there a way I can include my own code in the HTML in the same way I can include 3rd party scripts? I already include a library called Overlapping Marker Spiderifier via this line:

Is there a way to do the same with a script stored in my Wix public directory, like:

<script src="public/my_code_to_reuse.js"></script> 

? Thanks in advance for any help guys.

-John

1 Like

ok let me rephrase & simplify my question. Normally, when writing your own html file, you can include javascript files you have written like:

Is this possible within Wix html components, and if so, where should i store my_javascript_code.js ?