Jump to content

Target individual image from Portfolio gallery to redirect to separate page on site

Recommended Posts

Site URL: http://www.dntl.co.uk

Hi all,

I'm hoping someone can help. I currently have a Portfolio / Gallery of images on my homepage and I'm trying to get one particular image in that gallery to link to the separate /shop section of my page rather than the current /work/merch which is currently pointing at. 

If I try to change the Slug in the settings / cog icon. I can only change the 'merch' part. It doesn't allow me select the entire line.

If I play around with inspect on Google Chrome, all I need to do is change this:

<a class="grid-item" href="/work/merch" id="yui_3_17_2_1_1592494658970_189">

to this:

<a class="grid-item" href="/shop id="yui_3_17_2_1_1592494658970_189">

And I get the desired effect, but obviously that's not a permanent change. 

I've tried, using a extremely basic knowledge of coding, to inject some code but soon found out the YUI constantly changes and can't see a 'block-id' that pertains to this particular image. 

Is there any way around this?

My client doesn't want the site live yet, so apologies that I can't show it. But hopefully I've been clear!

Any help, much appreciated. 

Cheers,

Ross

Link to comment
  • Replies 9
  • Views 577
  • Created
  • Last Reply
// Add this code to Settings -> Advanced -> Code Injection -> Footer
<script>
(function(){
	window.addEventListener('load', function() {
	var link = document.querySelector('a[href="/work/merch"]');
    link.href = 'https://www.dntl.co.uk/shop';

})

})()
</script>

 

Philadelphia, PA

👉 Squarespace Tutorials 

Chat/Message on FB Messenger for quickest responsehttps://m.me/dejaegherryan

 

Link to comment
  • 7 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.