I want one of my Homepage Navigation Header Links to Open in a New Tab vs. Internal Redirect

Solved
Highlighted
New Member
4 0 0

I have the Icon theme. I want one of my Homepage Navigation Header Links to Open in a New Tab vs. Internal Redirect to a page on my website. 

Specifically, I want my "Blog" to open a new tab to my "Blog" that's hosted on another domain. 

Thank you!!

0 Likes
Highlighted
Astronaut
1083 178 213

Hello,

Please send the URL of your website so we can analyze it and help you out. Thanks!

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes
Highlighted
New Member
4 0 0
www.nourzero.com
On the header, BLOG, I want to go to a new URL vs. redirecting within the
same tab. Thanks!
0 Likes
Highlighted
New Member
4 0 0

www.nourzero.com

On the header, BLOG, I want to go to a new URL vs. redirecting within the same tab. Thanks!
0 Likes
Highlighted
Astronaut
1083 178 213

This is an accepted solution.

Hey,

1. In your theme.liquid file, find the </body> (press CTRL + F or command + F on Mac)
2. paste this code right above the </body> tag:

<script>
  document.addEventListener("DOMContentLoaded", function() {
Array.from(document.querySelectorAll('#shopify-section-mobile-navigation a, #shopify-section-header a'))
  .filter(el => el.textContent.toLowerCase().trim() === 'blog' )
  .map(e => e.setAttribute('target', '_blank'))
            });

</script>


Let me know if it works!

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
1 Like
Highlighted
New Member
4 0 0
Amazing, it worked! Thank you!
0 Likes
Highlighted
Astronaut
1083 178 213

You're welcome!

Please don't forget to mark my answer as solution and give it a like

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes