Jump to content

Blog - Images to link to Source URL ?

Go to solution Solved by tuanphan,

Recommended Posts

Hi, I have a site set up and use Blog posts which link to Source Urls (pages on the site) I set things up this way because the client wanted to use Categories. 

I wanted to know if it's possible to set the featured image to link to the same Source URL as the title and button? 

Thanks!

Link to comment
  • Solution

Try this to Website Tools (under Not Linked) > Code Injection > Footer. If it doesn't work, you can share link to blog page, we can check easier

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(".blog-basic-grid .blog-basic-grid--container").click(function(){
		window.location=$(this).find(".blog-title a").attr("href"); 
		return false;
	});
</script>

 

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
23 hours ago, HH22 said:

@tuanphan Thank you! That's worked. Is there a way to add something to this script which would change the arrow to the hand when hovering over the images, like it does for the other site links? 

https://www.southamericarep.com/all-properties

Try adding this code under

<style>
  article.blog-basic-grid--container.entry.blog-item.is-loaded>div:first-child {
    cursor: pointer;
    pointer-events: initial !important;
}
</style>

 

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
  • 2 weeks later...
  • 1 month later...

Hello,

 

I'm trying to get this same function to work with a side-by-side blog display. Any help on updating the code? This is as far as I've gotten but nothing seems to work:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(".blog-side-by-side .blog-side-by-side--container").click(function(){
        window.location=$(this).find(".blog-title a").attr("href"); 
        return false;
    });
</script>

 

Thank you!

Link to comment
On 3/6/2024 at 5:55 AM, JanMMD said:

Hello,

 

I'm trying to get this same function to work with a side-by-side blog display. Any help on updating the code? This is as far as I've gotten but nothing seems to work:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(".blog-side-by-side .blog-side-by-side--container").click(function(){
        window.location=$(this).find(".blog-title a").attr("href"); 
        return false;
    });
</script>

 

Thank you!

Can you share link to your blog page?

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
  • 2 months later...

Also trying to get this function to work on a masonry blog. Here's what I have, but it's not working. 

URL is https://baptistschools.squarespace.com/baptist-educator-archive

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(".blog-masonry .blog-image-wrapper").click(function(){
		window.location=$(this).find(".blog-title a").attr("href"); 
		return false;
	});
</script>

Appreciate any help you can provide. Thanks.

Link to comment
13 hours ago, adamehoar said:

Also trying to get this function to work on a masonry blog. Here's what I have, but it's not working. 

URL is https://baptistschools.squarespace.com/baptist-educator-archive

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(".blog-masonry .blog-image-wrapper").click(function(){
		window.location=$(this).find(".blog-title a").attr("href"); 
		return false;
	});
</script>

Appreciate any help you can provide. Thanks.

What is password?

image.png.42306bf19aea1f5726fbad020bae73e6.png

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
12 hours ago, adamehoar said:

Sorry, live now. You can see at the following URLs:

baptistschools.squarespace.com/baptist-educator-archive

baptistschools.org/baptist-educator-archive

Use this new code to Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$('article.blog-item').each(function() {
    var cr = $(this).find('a.passthrough-link');
    $(this).find('.blog-image-wrapper a').attr('href', cr.attr('href'));
});
</script>

 

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

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.