Magento: Add Javascript and CSS to Home Page Only

Magento allow you to modify the layout XML specific to that page. So, all you need to do is :

1. Login into Magento admin
2. Go to CMS->static pages
3. Edit home page
4. Go to design tab, in Custom design tab, Add the following code into "Custom Layout Update XML" field to add css or javascript file.
<reference name="head">
  <action method="addItem">
    <type>skin_js</type><script>js/home.js</script>
   </action>
  <action method="addItem">
    <type>skin_css</type><script>css/home.css</script>
   </action>
</reference>

Comments

Popular Posts