wzrdofthestnk Posted February 20 Posted February 20 Hey. I want to change the links on my website to non-follow. www.stunk.info Password: 4204200 Can someone help me?
Collaborada Posted February 20 Posted February 20 Hi @wzrdofthestnk. This solution works: https://ryandejaegher.com/fix-amazon-affiliate-links-in-squarespace/ Building high-performance websites with expert SEO for local and national reach. Have an SEO question? Google to find our advice or book a Zoom session for tailored help. ★ Squarespace since 2013 ★
wzrdofthestnk Posted February 21 Author Posted February 21 13 hours ago, Collaborada said: Hi @wzrdofthestnk. This solution works: https://ryandejaegher.com/fix-amazon-affiliate-links-in-squarespace/ Does this work, even though I didn't use the amazon block but the gallery section instead. And the script is searching for any link that has "amazon" in it. Can I just leave it like that or should I change the parts up to something like "https://" What would be a smart way to do this?
Collaborada Posted February 21 Posted February 21 Hi there. Yes, you need to adjust it for your needs. wzrdofthestnk 1 Building high-performance websites with expert SEO for local and national reach. Have an SEO question? Google to find our advice or book a Zoom session for tailored help. ★ Squarespace since 2013 ★
wzrdofthestnk Posted February 21 Author Posted February 21 Thanks. This really worked for me by just replacing the "amazon.com" and "amzn.to" part with "https://" and "www." 👍🏼 Collaborada 1
wzrdofthestnk Posted February 22 Author Posted February 22 (edited) @Collaborada Any idea how to make the internal links to my pages NOT open up in a new tab. <script> (function () { window.addEventListener('load', function () { var fixAmazonLinks = function () { var amazonLinks = document.querySelectorAll( 'a[href*="https://"], a[href*="www."]' ); if (!amazonLinks instanceof NodeList) { return; } amazonLinks.forEach(link => { link.rel = 'nofollow'; link.target = '_blank'; }); }; fixAmazonLinks(); }); })(); </script> Edited February 22 by wzrdofthestnk
Collaborada Posted February 22 Posted February 22 Hi there. The target="_blank" attribute tells a browser to open a link in a new tab. Building high-performance websites with expert SEO for local and national reach. Have an SEO question? Google to find our advice or book a Zoom session for tailored help. ★ Squarespace since 2013 ★
wzrdofthestnk Posted February 22 Author Posted February 22 (edited) 1 hour ago, Collaborada said: Hi there. The target="_blank" attribute tells a browser to open a link in a new tab. Thanks, I tried "blank" and "self" both not working for my needs. I need a solution to make the links that lead to my internal pages open in same tab and links that lead to external pages open in different tab Any ideas how I can manage this myself? Thanks Edit: If if disable the "open link in new tab" in the content section of my carousel slides it still opens my internal links in a new tab. Any way I can make this feature usable again? Might have to do with this code I added to Code Injection -> Footer, that made my images and cards clickable in the carousel sections. Would really appreciate the help ! <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> $( ( ) => { const selector = '.user-items-list-carousel__slides .list-item'; $( selector ).each ( function ( ) { const $this = $( this ); $( $this ).click ( function ( ) { const url = $( '.list-item-content__button', $this ) .attr ( 'href' ); $( `<a href="${ url }" target="_blank">` ) .get ( 0 ) .click ( ); } ); } ); } ); </script> <style> .user-items-list-item-container[data-section-id="6531f15eb6b9412a3a3bb456"] .user-items-list-carousel__slide { pointer-events: initial !important; user-select: unset !important; } .user-items-list-item-container[data-section-id="6531f15eb6b9412a3a3bb456"] .user-items-list-carousel__gutter { cursor: pointer; } </style> Edited February 22 by wzrdofthestnk
Collaborada Posted February 22 Posted February 22 When you create an internal link you'll want to make sure the toggle for "open link in new tab" is toggled off. It tries to auto-detect external and internal links--but currently, it isn't detecting all internal links. Good luck! Beyondspace 1 Building high-performance websites with expert SEO for local and national reach. Have an SEO question? Google to find our advice or book a Zoom session for tailored help. ★ Squarespace since 2013 ★
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment