Social media links opened in new tab please

Hi, can you please make all my social media links open in a new tab.
Thank you in advance!

url: hygiadental.com
pw: myown

Hello @Anonymous

Login on your Admin → Go to the Online store → Edit theme code https://prnt.sc/jUfNuFNulliN

Under the theme edit find main-password-footer https://prnt.sc/WEOtVONYg4Ip and Open the file on click of this https://prnt.sc/RSb6KzIQPHO3

Now you can see there are <a tag for different social media icons you have to add the target=ā€œ_blankā€ on it.

Before: https://prnt.sc/6qza0xeQNalY

After add of target=ā€œ_blankā€ it will be look like this https://prnt.sc/-lY_LBOl7E-u

You have to do the same in all the social media link to open it in the new tab and save the file.

AND after entering the password there is a social media icon on footer as well so for that you have to find the.

social-icons https://prnt.sc/Uprzp5Evw6ZX and add the target=ā€œ_blankā€ in all the <a tag in the file to open it in new tab.

If you require further help to optimize your store, please don’t hesitate to reach out.

If you find this information useful, a Like would be greatly appreciated.

And if this solves the problem, please Mark it as Solution!

If you want me to help you on this if you don’t know about the code then let me know. I am happy to help you.

1 Like

@Anonymous Please follow the below steps to open the social media links in new tab. Let us know whether it is helpful for you.

  1. Go to ā€œOnline Storeā€ → ā€œThemesā€.
  2. Click action button from the current theme and select ā€œEdit codeā€.
  3. Go to ā€œsocial-iconsā€ file and find class=ā€œlink list-social__linkā€ then enter below code in replace box.
class="link list-social__link" target='_blank

  1. Then click ā€˜Replace All’ button and save changes.

Now the social media links will open on new tab.

Please provide your support by click ā€œLikeā€ and ā€œAcceptedā€ if our solution works for you. Thanks for your support.

It worked!!! Thanks a lot :slightly_smiling_face:

I found a way to do this without editing the theme code directly. This worked in the Dawn theme, and with small modifications, it should work on other Shopify themes too.

  1. In your Shopify customizer, go to your Footer section.

  2. Add a new Custom Liquid block.

  3. Remove all padding so the block won’t be visible on the storefront.

  4. Paste this code into the Liquide Code block:

<script>
  document.querySelectorAll('.footer__list-social .list-social__link').forEach(link => {
    link.setAttribute('target', '_blank');
    link.setAttribute('rel', 'noopener noreferrer');
  });
</script>

Now all your social media links in the footer will automatically open in a new tab.
Let me know if that also worked for you.