I have this MailChimp embed script (for a subscribe popup) that I want to use on all the pages in my Magento 1 installation, except for one CMS page (because it already contains an embed script for a subscribe popup).

Normally, I would add this script to the 'Miscellaneous Scripts' option in System > Configuration > Design. How can I solve this the right way?

1 Answer 1


You could add the script using xml. Then you could use the layout update xml tab within the admin for the CMS page you want to remove script from the page. e.g:

1. Add JS to all pages:

<?xml version="1.0"?>
  <layout version="0.1.0">
      <reference name="head">
        <action  method="addItem"><type>skin_js</type><name>js/popup.js</name></action>

This could be added to your local.xml file within your theme and will apply to all pages then due to being within default node.

2. Remove JS from a CMS Page:

<reference name="head">
  <action method="removeItem"><type>skin_js</type><name>js/popup.js</name>

This can be added to that CMS pages layout update xml field within admin so is just applied to that page. Navigate to CMS -> Pages -> Design. Then paste above into the layout update xml field.

3. Add JS file to filesystem.

The popup.js file should then be placed within the themes's JS folder:

  • Very nice answer! I had multiple javascript files, so I used your method, but instead of using js files, I used a static block. Still, good answer! Nov 20, 2017 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.