Jump to content

How to open Link Post Title to Source URL in the same tab/NOT a new tab

Recommended Posts

Posted

Hi there,

I am using the linking Post Title to Source URL and want the blog post title links to open in the same tab.

I tried to used this code but understand it makes all external link open in the same tab:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('a').attr('target','_self');
});
</script>

However, I would like to keep the social links and the About link to open in a new tab.

Is there a way to open only blog post links in the same tab and keep social links and About link open in a new tab?

Posted
8 hours ago, tuanphan said:

Change

_self

to

_blank

If you want this

Is there a way to open only blog post links in the same tab and keep social links and About link open in a new tab?

please share link to your site, we can check easier

 

Thank you, this is the site link: https://www.cleverbranded.com

I changed the code from _self to _blank, which allowed the About & Social links to open in a new tab but when I click on the project titles, it opens them in a new tab which is something I want to avoid. Is that possible?

Posted
On 4/12/2023 at 12:25 AM, CleverCreativeMavericks said:

 

Thank you, this is the site link: https://www.cleverbranded.com

I changed the code from _self to _blank, which allowed the About & Social links to open in a new tab but when I click on the project titles, it opens them in a new tab which is something I want to avoid. Is that possible?

Use this code

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('a:not(.passthrough-link)').attr('target','_blank');
});
</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!)

  • 5 months later...
  • 2 months later...
Posted

Hello,

I have a similar problem - I'm happy with certain blogs opening in a new tab, but the blogs that I'm pulling through from a summary block on our homepage.

Should there not be some sort of toggle to enable this for blogs - whether that's on an individual or just blogs in general basis. I'm not a huge coder so hoping I can find a manageable work around. 

All help greatly appreciated!

Thanks!

Posted
18 hours ago, Katy_MF said:

Hello,

I have a similar problem - I'm happy with certain blogs opening in a new tab, but the blogs that I'm pulling through from a summary block on our homepage.

Should there not be some sort of toggle to enable this for blogs - whether that's on an individual or just blogs in general basis. I'm not a huge coder so hoping I can find a manageable work around. 

All help greatly appreciated!

Thanks!

Can you share link to page where you have problem?

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!)

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.