Page loading speed due to JS

Hello. I’ve noticed 3 of my website pages loading slower due to JS size. How can I replace the default JS file in Hubspot with it minified version?

Here are URLs in question:
1. https://know-how.lagoo.ch/hs-fs/hub/253701/hub_generated/template_assets/53545663091/1691488766665/Act3_child_Lagoo/js/components/tag-list.min.js
2. https://segelschule.lagoo.ch/hs-fs/hub/253701/hub_generated/template_assets/53548497558/1691488747455/Act3_child_Lagoo/js/components/lightbox.min.js
3. https://know-how.lagoo.ch/hs-fs/hub/253701/hub_generated/template_assets/53545663092/1691488764490/Act3_child_Lagoo/js/components/blog-search.min.js

Hi @ALienhart, I can suggest how to do the default JavaScript files with their minified versions in HubSpot, you can follow these steps:

As you did, try again. Do minify Your JavaScript Files:
First, make sure you have minified versions of the JavaScript files that are currently causing slower loading times.

Access Template Settings:
In your HubSpot account, go to the Design Manager and locate the templates associated with the pages you mentioned. Open the template settings for each template.

Edit Template:
Edit the HTML of the template by clicking on the “Edit code” option for that template.

Replace JavaScript Links:
Inside the HTML code of your template, Replace the URLs with the URLs of the minified versions of your JavaScript files.

For example, replace:

<script src=“https://know-how.lagoo.ch/hs-fs/hub/253701/hub_generated/template_assets/53545663091/1691488766665/A.js”></script>

With:

<script src=“path-to-minified-file.min.js”></script>

Replace path-to-minified-file.min.js with the actual URL or relative path to your minified JavaScript file.

Save and Test:
After replacing the JavaScript links with the minified versions, save the template. Test the pages again to ensure that they load faster due to the use of minified JavaScript files.

Republish:
If you’re using HubSpot’s content staging, make sure to publish the updated template to your live website after testing and confirming that everything is working as expected.

Same as do apply your original template code, and always test thoroughly to ensure that the new minified JavaScript files do not cause any issues on your pages.

Hope this help!

Feel free to contact on syedanabeelafatima7@gmail.com for more help.

Cheers!