0

i have too much outgoing link on my website. i want to make them all no index for google. i dont want to write rel="no index" per link...

(< a href="..." rel="noindex, nofollow" >...< /a > )

can i create a class and write this with css?

and then

<div class="noindexlinks">

Is this possible? Or can I edit my htaccess for this?

website

justinw
  • 3,856
  • 5
  • 26
  • 41

1 Answers1

1

You can not assign html attributes via css.

You can however accomplish what you are looking to do with an arbitrary css class and some jQuery.

  • First, create an arbitrary class, like no_follow_links

  • Assign this class to various <a> tags like, <a class="no_follow_links" href="http://address.com">

  • Write your jQuery code, demo using the attr method

NOINDEX is a meta tag, you're looking for nofollow on your <a> tags.

$(".no_follow_links").each(function(){
 $(this).attr("rel","nofollow");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a class="no_follow_links" href="http://google.com">Link</a>
<a class="no_follow_links" href="http://bing.com">Link</a>
<a class="no_follow_links" href="http://yahoo.com">Link</a>
justinw
  • 3,856
  • 5
  • 26
  • 41