The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. White Hat / Black Hat SEO
    4. Changing Links to Spans with Robots.txt Blocked Redirects using Linkify/jQuery

    Changing Links to Spans with Robots.txt Blocked Redirects using Linkify/jQuery

    White Hat / Black Hat SEO
    3 2 71
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • STDCarriers
      STDCarriers last edited by

      Hi,

      I was recently penalized most likely because Google started following javascript links to bad neighborhoods that were not no-followed. The first thing I did was remove the Linkify plugin from my site so that all those links would disappear, but now I think I have a solution that works with Linkify without creating crawlable links. I did the following:

      1. I blocked access to the Linkify scripts using robots.txt so that Google won't execute the scripts that create the links. This has worked for me in the past with banner ads linking to other sites of mine. At least it appears to work because those sites did not get links from pages running those banners in search console.

      2. I created a /redirect/ directory that redirects all offsite URLs. I put a robots.txt block on this directory.

      3. I configured the Linkify plugin to parse URLs into span elements instead of a elements and add no follow attributes. They still have an href attribute, but the URLs in the href now point to the redirect directory and the span onclick event redirects the user.

      I have implemented this solution on another site of mine and I am hoping this will make it impossible for Google to categorize my pages as liking to any neighborhoods good or bad. Most of the content is UGC, so this should discourage link spam while giving users clickable URLs and still letting people post complaints about people that have profiles on adult websites. Here is a page where the solution has been implemented https://cyberbullyingreport.com/bully/predators-watch-owner-scott-breitenstein-of-dayton-ohio-5463.aspx, the Linkify plugin can be found at https://soapbox.github.io/linkifyjs/, and the custom  jQuery is as follows:

      jQuery(document).ready(function ($) {
          2
          $('p').linkify({
              tagName: 'span',
              attributes: {
                  rel: 'nofollow'
              },
              formatHref: function (href) {
                  href = 'https://cyberbullyingreport.com/redirect/?url=' + href;
                  return href;
              },
              events:{
                  click: function (e) {
                      var href = $(this).attr('href');
                      window.location.href = href;
                  }
              }
          });
          3
      });
      
      1 Reply Last reply Reply Quote 0
      • BlueprintMarketing
        BlueprintMarketing last edited by

        301 or 302 redirecting well if you’re going to do one you should do 302 but it’s not going to help you much unless you’re going to send the URL to a 410 when something is no followed it is the same thing as what robots.txt will do.

        https://support.google.com/webmasters/forum/AAAA2Jdx3sUEbHp0yjgT6c?hl=sv

        do you have a report from Google knowing that you have been penalized?

        is there anyway you could run Screaming Frog and show some of these URLs that you’re talking about?

        respectfully,

        Tom

        1 Reply Last reply Reply Quote 0
        • STDCarriers
          STDCarriers last edited by

          I know I was penalized because search console recorded an overnight drop in impressions/clicks of 75%. Never was a problem before. I didn't need to run Screaming Frog or anything to find links that explain the problem. I just browsed some of the user generated content and then once I realized that Google was crawling javascript generated links it all made sense.

          Some of the sites people were liking to included: CheaterLand.com, PredatorsWatch.com, DirtyHomeWreckers.com, EscortBabylon.net, SugarDaddyforMe.com, GFEMonkey.com, EscortBabylon.com, CityXGuide.com, and AdultLook.com.

          I think as long as Google respects the robots.txt directives I should be just fine. The redirect page itself is blocked by robots.txt so even if Google finds one of those URLs (ex: https://cyberbullyingreport.com/redirect/?url=https://moz.com/community/q/changing-links-to-spans-with-robots-txt-blocked-redirects-using-linkify-jquery) it shouldn't even follow the 302 since the robots.txt file (https://cyberbullyingreport.com/robots.txt) disallows that directory.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          • C-Block and link juice
            EGOL
            EGOL
            0
            2
            63

          • Do I lose link juice if I have a https site and someone links to me using http instead?
            TheWebMastercom
            TheWebMastercom
            0
            5
            951

          • Link Building / Link Removal
            Stew222
            Stew222
            0
            10
            164

          • How to redirect a URL with "ñ" like domain.com/folder-name/name-ñ/ to another URL with ñ?
            redfishking
            redfishking
            0
            2
            397

          • What EMD Meta Title should we use and what about getting links to the same C-Block IP?
            TT_Vakantiehuizen
            TT_Vakantiehuizen
            0
            7
            263

          • Blogger Reviews w/ Links - Considered a Paid Link?
            patrickmartin
            patrickmartin
            0
            6
            471

          • Link Building using Badges
            Amjath
            Amjath
            0
            3
            981

          • Would linking out to a gambling/casino site, harm my site and the other sites it links out to?
            Getz.pro
            Getz.pro
            0
            7
            9.8k

          Get started with Moz Pro!

          Unlock the power of advanced SEO tools and data-driven insights.

          Start my free trial
          Products
          • Moz Pro
          • Moz Local
          • Moz API
          • Moz Data
          • STAT
          • Product Updates
          Moz Solutions
          • SMB Solutions
          • Agency Solutions
          • Enterprise Solutions
          • Digital Marketers
          Free SEO Tools
          • Domain Authority Checker
          • Link Explorer
          • Keyword Explorer
          • Competitive Research
          • Brand Authority Checker
          • Local Citation Checker
          • MozBar Extension
          • MozCast
          Resources
          • Blog
          • SEO Learning Center
          • Help Hub
          • Beginner's Guide to SEO
          • How-to Guides
          • Moz Academy
          • API Docs
          About Moz
          • About
          • Team
          • Careers
          • Contact
          Why Moz
          • Case Studies
          • Testimonials
          Get Involved
          • Become an Affiliate
          • MozCon
          • Webinars
          • Practical Marketer Series
          • MozPod
          Connect with us

          Contact the Help team

          Join our newsletter
          Moz logo
          © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
          • Accessibility
          • Terms of Use
          • Privacy