CMS Development

josephLayden
Contributor

Content Settings renders script tag twice causing duplicate JS error

SOLVE

Screen Shot 2018-02-19 at 8.34.36 AM.pngScreen Shot 2018-02-12 at 12.17.45 PM.png

0 Upvotes
1 Accepted solution
SaraLynnn1
Solution
Contributor

Content Settings renders script tag twice causing duplicate JS error

SOLVE

Maybe I'm confused as to what you are trying to accomplish by adding the script to the content settings. Is there an external app you are trying to call to your template? Also, your screenshot shows that you added it to the BLOG header HTML in content settings...but the page you reference is a landing page?

 

I did find a post that seems like it might be related to the issue you are having: https://integrate.hubspot.com/t/uglified-javascript-throwing-errors-only-in-hubspot/6675/11

 

Without knowing more about what you are trying to accomplish by adding the app.js and app.css files via content settings, it's hard to determine what's going on.

 

Also, when I visit the page you reference in your screenshot (http://2942250.hs-sites.com/landing-page), I do not get the error you describe. Try logging out of your account and see if it still appears.

 

 

Lastly, check out this article on adding JS files to your templates (or sitewide). It appears you may have not referenced the file correctly in the content settings header/footer HTML: https://knowledge.hubspot.com/design-manager-user-guide-v2/how-to-add-a-javascript-file-to-hubspot.

 

Let me know if that helps or if you have more details on what your overall goal is for adding this script to your site.

View solution in original post

4 Replies 4
SaraLynnn1
Contributor

Content Settings renders script tag twice causing duplicate JS error

SOLVE

@josephLayden Can you post a screenshot of the error you are seeing? And clarify exactly which script is being rendered twice? The line highlighted in orange does not seem to be rendering elsewhere?

0 Upvotes
josephLayden
Contributor

Content Settings renders script tag twice causing duplicate JS error

SOLVE

Screen Shot 2018-02-19 at 8.28.24 AM.png

0 Upvotes
josephLayden
Contributor

Content Settings renders script tag twice causing duplicate JS error

SOLVE

Its not visible in view but there are two.  As I was trying multiple combinations of files, app.js and app.min.js are the same just one not minified so  control + f shows 1 of 3 now.  It is the only script included other than hubspot and jquery.  It prints twice when I use the content settings to save the script, but if I save it in the head of the template in design manager it prints once and i do not get an error.  The babel polyfill error only occurs when the script is set in the content settings head or footer area, and is resolved by not loading the script twice.  There are no errors locally on the script.

0 Upvotes
SaraLynnn1
Solution
Contributor

Content Settings renders script tag twice causing duplicate JS error

SOLVE

Maybe I'm confused as to what you are trying to accomplish by adding the script to the content settings. Is there an external app you are trying to call to your template? Also, your screenshot shows that you added it to the BLOG header HTML in content settings...but the page you reference is a landing page?

 

I did find a post that seems like it might be related to the issue you are having: https://integrate.hubspot.com/t/uglified-javascript-throwing-errors-only-in-hubspot/6675/11

 

Without knowing more about what you are trying to accomplish by adding the app.js and app.css files via content settings, it's hard to determine what's going on.

 

Also, when I visit the page you reference in your screenshot (http://2942250.hs-sites.com/landing-page), I do not get the error you describe. Try logging out of your account and see if it still appears.

 

 

Lastly, check out this article on adding JS files to your templates (or sitewide). It appears you may have not referenced the file correctly in the content settings header/footer HTML: https://knowledge.hubspot.com/design-manager-user-guide-v2/how-to-add-a-javascript-file-to-hubspot.

 

Let me know if that helps or if you have more details on what your overall goal is for adding this script to your site.