alex
alex

Reputation: 7895

Multiple rel attributes

How would Google behave if encounter with a link having two different rel attribute?

<a href="example.com" rel="follow" rel="nofollow">hello</a>

I'm trying to purge content user insert into DB. I need to prevent user from making links as follow for search engines, but I'm not going to do it for internal links so I can't use meta in header to prevent all links from following. So if a user has added rel attribute manually I would have the new link with two rel like above example. I use this method for making my regex.

Upvotes: 3

Views: 3872

Answers (1)

Nikhil Nanjappa
Nikhil Nanjappa

Reputation: 6632

You cannot have more than one rel attribute into one element, but you can insert more than one argument into a single rel attribute value - just delimit them with a space:

Valid: <a href="example.com" rel="follow nofollow">hello</a>

Not Valid: <a href="example.com" rel="follow" rel="nofollow">hello</a>

I think for what you are looking for :

GoogleBot does obey the rel="nofollow" attribute.. as for rel="follow" - I don't think so. rel="follow" is only used to override the default "nofollow"

It actually depends on what you want to achieve, If you want "nofollow" then just use rel="nofollow" & the rel="follow" is not needed, But on the other hand if you want rel="follow", then you need to provide rel="nofollow" first and then override it by rel="follow" like below

<a href="example.com" rel="nofollow follow">hello</a>

Here is a good article which explains it

Upvotes: 4

Related Questions