Start a new topic

Where is the proper place for JS and CSS in XML.CONFIG packages?

Hi!


Hopefully it's a simple question.


I am customizing our product.VariantsInRightBar.xml.config file so I am trying to replace the regular variant picture with a slideshow which depends on a couple JS functions and CSS). However I am having difficulty on find the right place for it. I tried to place it everywhere but it's crashing the page.


Where is the proper place for custom JS and CSS there?


Thanks!


xml/xslt inside of a xmlpackage (.xml.config) can have issues with JavaScript and CSS due certain characters meaning something else for xml. Warping the JavaScript in cdata section will avoid the characters issues.


For example

 

<script>
	<![CDATA[
		function onentityrelatedClick() {							
		ga('send', 'event', 'UX', 'click', 'related catagory click');
		}
	]]>
</script>

 

After some trial and error I figured that the proper place is after the params of the template.

Login or Signup to post a comment