Created
November 30, 2012 12:38
-
-
Save opistola/4175526 to your computer and use it in GitHub Desktop.
Jquery script to add rel="nofollow" to all likes besides the current domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('a').each(function() | |
| { | |
| var reg_exp = new RegExp('/' + window.location.host + '/'); | |
| if (!reg_exp.test(this.href)) | |
| { | |
| // External Link Found | |
| $(this).attr('rel','nofollow'); | |
| } | |
| }); |
var reg_exp = new RegExp('site.com');
$('a').each(function()
{
if (!reg_exp.test(this.href))
{
// External Link Found
$(this).attr('rel','nofollow');
}
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi
how can i set rel nofollow for custom link ?
i want no follow just site.com