Clickthrough URLs on Wexley and Wells Gallery in Squarespace
If you're using the Wells or Wexley template on Squarespace, you've probably realized by now that the GALLERY pages let you insert a clickthrough URL for each image, but those don't actually function as clicking on an image will just open the image in full-screen mode. Here's how you can have clickthrough URL's working on image galleries in the Wells and Wexley template.
Click the GEAR icon on the gallery page.
Enter this code under ADVANCED → PAGE HEADER CODE INJECTION.
<script> var currentPageBaseURL=window.location.href.split("?")[0]; Y.on("domready",function(e){ Y.io(currentPageBaseURL+"?page=1&format=json-pretty", { on:{success: jsonLoaded} }); function jsonLoaded(err,data){ var jsonResponse = Y.JSON.parse(data.responseText); var items=jsonResponse.items Y.all("#thumbnails .thumb, #slideshow .slide").each(function(e){ var thumbId=this.getAttribute("data-slide-id"); for(var i=0;i<items.length;i++){ if(thumbId==items[i].id && items[i].clickthroughUrl){ this.setAttribute("data-clickthrough-url",items[i].clickthroughUrl).on("click",function(e){ e.preventDefault(); e.stopPropagation(); window.location = this.getAttribute("data-clickthrough-url"); }) } } }) } }); </script>