How to add JavaScript to post?

Hi,

I have a folder that consists of an index.html, a script.js and some images that get called by the script.js. Is it possible to somehow embed/include this JavaScript “project” in a Ghost post? When I embed the CodePen code it shows the editor view on the published post page. This is not what I want.

I self-host and have access to the files via Cyberduck.

Thanks.

Sure, you can use an HTML card inside the editor, with <script> tags - or you can add the script via Code Injection → inside the Post Settings Menu (settings cog in the top right)

3 Likes

Thanks, John. Made it work. Such scripts do not get loaded in emails to subscribers though, do they?

That’s correct - email clients don’t support embedded scripts

thanks my issue has been fixed.