Jump to content

Disable thumbnail blog thumbnail image from being click or changing the link

Recommended Posts

I'm not sure where either of those features are. 

I have this enabled and the title to the right points to the link.

image.thumb.png.908e2d7b26e1ae72c8fecd922b5e9c2e.png

However I can't seem to find the lightbox enabled/disabled or the where blog image click through is. 

Link to comment
On 12/26/2020 at 6:14 PM, tonynamlam said:

I'm looking to figure out how to disable the links on the thumbnails.

Add the following to Design > Custom CSS.

#collection-5f2b17fcf493e75e96fbf2e5 .collection-type-blog-side-by-side article a {

  pointer-events: none;
  
  }

 

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 2 weeks later...

Rather than disabling the thumbnail image clickthru, I had good results using Code Injection to set the clickthru URL of the thumbnail image to match the clickthru URL of the post title, which is the post Source URL.  I used the following Javascript code.

<script type="text/javascript">
document.addEventListener('DOMContentLoaded', initBlogImageClickthrus);
window.addEventListener('mercury:load', initBlogImageClickthrus);

function initBlogImageClickthrus(){
	var aPosts = document.querySelectorAll(".blog-masonry .image-wrapper");
	var i;
	for (i = 0; i < aPosts.length; i++) {
		var sPassthroughURL = "#"
		var oPassthroughLink = aPosts[i].parentNode.parentNode.querySelector(".passthrough-link");
		if (oPassthroughLink) {
			var sPassthroughURL = oPassthroughLink.href;
			aPosts[i].href = sPassthroughURL;
			aPosts[i].target = "_blank";
        }
	}
}
</script>

 

Link to comment
  • 1 month later...

HI @PoetessWebmaster

This code was really useful! Thank you - But my thumbnail and post title are opening the link in a new tab.

Is there a way to tweak the code to turn this off?

Website:https://primrose-koi-y2fj.squarespace.com/products?tag=Retinol

PW: ThesourceRN

The post links to here: https://primrose-koi-y2fj.squarespace.com/concentrated-retinol-serum

& I need the image link & title link to just open in the same tab if possible??

Thanks!

Edited by denisebmitchell
Link to comment

@denisebmitchell

If you remove the following line from the code provided that should stop the new tabs opening.

aPosts[i].target = "_blank";

Alternately you could comment it out by adding "// " (without the quotes) to the beginning of the line.

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 2 weeks later...
  • 1 month later...
On 4/17/2021 at 2:56 AM, yellowsharpie said:

Hey @PoetessWebmaster

I've tried using your code for my blog but it came up with an error and didn't work. 

Is there another script or css for this?

PS: I'm an absolute beginner 

Can you share link to blog page & take a screenshot of error?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 5 weeks later...
  • 1 month later...

@PoetessWebmaster and @creedon hoping you can help me. 

On the main page (https://lesmeet.com/shop) I have the blog post titles AND thumbnails linking to the external links in a new window - that's perfect and exactly what I need. However, this doesn't carry through when I apply a filter or click the metadata category titles. 

For example, clicking "services' filter, or going to https://lesmeet.com/affiliates?category=Services, when you click the post title it retains the external link (good!) but the thumbnail links to a blank blog post that no one should ever see. I want the thumbnail to also link to the external site, as with the post title. 

I think the code mentioned above might work, but needs a tweak to reflect my blog layout... which isn't "Masonry," but is "Basic Grid Blog."

THANKS!

example.png

Link to comment
  • 5 months later...
On 1/6/2021 at 12:47 PM, PoetessWebmaster said:

Rather than disabling the thumbnail image clickthru, I had good results using Code Injection to set the clickthru URL of the thumbnail image to match the clickthru URL of the post title, which is the post Source URL.  I used the following Javascript code.

<script type="text/javascript">
document.addEventListener('DOMContentLoaded', initBlogImageClickthrus);
window.addEventListener('mercury:load', initBlogImageClickthrus);

function initBlogImageClickthrus(){
	var aPosts = document.querySelectorAll(".blog-masonry .image-wrapper");
	var i;
	for (i = 0; i < aPosts.length; i++) {
		var sPassthroughURL = "#"
		var oPassthroughLink = aPosts[i].parentNode.parentNode.querySelector(".passthrough-link");
		if (oPassthroughLink) {
			var sPassthroughURL = oPassthroughLink.href;
			aPosts[i].href = sPassthroughURL;
			aPosts[i].target = "_blank";
        }
	}
}
</script>

 

Where did you post this considering it is java and not CSS?

This is awesome (I am a new web admin, and new to SquareSpace so my apologies if this seems confusing).

Link to comment
1 hour ago, ITCtoCTO said:

Where did you post this considering it is java and not CSS?

Add the Javascript code in Settings > Advanced > Code Injection > FOOTER.

 

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • 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.