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.

Step-1.jpg

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>
Vigasan

Hey! I’m Vigasan and I love the Internet. I have a Bachelor of Science in Computing Systems with a double specialization in Computer Science and Software Engineering. I’ve been creating websites and working with social media since 2014 and have created over 200 Squarespace websites so far.

https://www.adlyticmarketing.com/
Previous
Previous

Redirect a Folder Click In Navigation Menu on Squarespace

Next
Next

How to Add a Back to Top Button on Squarespace