The Better Way to Hide Links from SEO Crawlers

It’s no question that hiding links is critical to any successful SEO campaign.

When building links, especially on PBNs and the like, it’s important to block SEO crawlers like Ahrefs (ahrefsbot) and Majestic (MJ12Bot). Most SEOs accomplish through abhorrent .htaccess lists of bots to block.

what are all of these bots anyway?

The current solutions are…

  • .htaccess files
    • Not always applicable if you don’t have full control over the site
    • Often times blocked from being edited
    • Require some technical know-how, updating, and blind trust
    • Footprint if set up incorrectly
      • Blind trust / copying pasting code you find online is bound to lead to problems
      • Most .htaccess codes available online redirect bots to webMD.com
  • robots.txt
    • (lol)
  • WordPress plugins
    • Not so great if you’re not using WordPress
    • Require blind-trust in the author of the plugin
    • Footprint if (when) set up incorrectly (more on that in another post)

Using Javascript, we can abuse the achilles heel of crawlers and have links “hidden” in the source code of a site, but visible on the page load.

This is what the SEO crawlers will see (no visible links), but here is what Google will see.

Because we broke the link up into two parts (variable a and variable b) and combined the variables when the page loaded, we were able to hide our link from third party SEO crawlers.

This requires little to no technical knowledge and relies on simple Javascript. No sneaky redirects or cloaking.

This is helpful for those who are also building links on public facing properties and can place Javascript: most website builders and submission platforms allow Javascript embed within the HTML, but not access to .htaccess or robots.txt. Using this, you can block your competitors from viewing more than just your PBNs!

You can view the code for this here. Replace link with your anchor text, and replace the URL split among the two variables with your own.

After doing so, simply invoke your link by using <span id=“target”></spaninstead of the hyperlink HTML code.

22 comments

  1. Hi yasher..,, this is really amazing…. But still confused how to implement…. Since i m not good with codes…i could find htaccess file… Rest i m unsure….

    1. next time you try to score a link, please put in a bit more effort. implementation is described in the post and an example has been given as well.

  2. Thanks yashar, this is amazing post. As I am coder i know how JavaScript will work at pageload. This is brilliant idea to hide Backlinks from competitors.

    1. Hi, Tell me If I am wrong, I put JavaScript at ” page specific script” on WordPress Post and I put “You can simply put the here” at any where in my post. Thanks

  3. Obviously you need to block crawlers coming from your PBN to your money site, I would suggest even blocking the crawlers to the PBN sites also, just make it invisible completely, the .htaccess method is very efficient and I would not suggest using plugins, plugins are one of the ways usually sites gets spammed or hacked.

    1. There are pros and cons to all methods of hiding links. I agree with you that plugins are inefficient, but .htaccess has some problems due to its nature, even when “set up properly”.

  4. Hey

    Nice trick Yashar- I’m unfortunately not a good coder, but I managed to get it to work on normal text links but I can’t figure out how to hide image links with this method.
    I have tried to add in the script but it does nothing.
    Hope you or another can help me out.

    Best regards

    1. The issue arises because you are using double quotes twice because you are including an image source URL in the image tag.

      Simply replace the inner double quotes with single quotes and you should be fine. Here is a code sample using a linked image: http://pastebin.com/B1k1WG1Y

  5. Question from a technical standpoint.

    Do crawlers from Majestic, Ahrefs, Semrush, etc. crawl the site differently than Google?

    I just want to understand why it doesn’t impact Google’s ability to recognize the link.

    1. Yes. Crawlers such as Majestic, Ahrefs, and SEMRush only have the capacity to view the source code of the site and parse links from the source code (looking for the “a” tag).

      Google, however, can not only parse the source code of a page, but also render the page. The Javascript code above only renders links on page load, which prevents SEO crawlers from recognizing links.

Leave a Reply

Your email address will not be published. Required fields are marked *