How to Add rel="nofollow" to Links?
-
I just tested it and it works.
I installed
nodebb-plugin-sanitizehtml
, enabled it, and enabled HTML (from Plugins -> Markdown -> Allow HTML).$ npm install nodebb-plugin-sanitizehtml
Then changed the settings for "allowed attributes" to:
{"a":["href","name","target","rel"],"img":["src","class","alt","title"]}
and "allowed tags" to:
["h1","h2","h3","h4","h5","h6","blockquote","p","a","ul","ol","nl","li","b","img","i","strong","em","strike","code","hr","br","div","table","thead","caption","tbody","tr","th","td","pre"]
Now this should work:
<a href="http://amazon.com/" rel="nofollow">Amazon </a>
-
You should enter the array of tags and the array of attributes.
If you forget to add "rel" in the array of allowed attributes, it would not work. You can copy my examples, I mentioned above:
Settings for "allowed attributes":
{"a":["href","name","target","rel"],"img":["src","class","alt","title"]}
Settings for "allowed tags":
["h1","h2","h3","h4","h5","h6","blockquote","p","a","ul","ol","nl","li","b","img","i","strong","em","strike","code","hr","br","div","table","thead","caption","tbody","tr","th","td","pre"]
Or you can enable only the "a" tag:
Allowed attributes:
{"a":["href","name","target","rel"]}
Allowed tags:
["a"]
-
-
The current version of NodeBB is adding "nofollow" to all external links. Testing this:
https://www.youtube.com/
https://community.nodebb.org/How to disable this feature? I want "nofollow" only on some links.
-
@revir said in How to Add rel="nofollow" to Links?:
If you want to promote something, you should use the widget to add html code to that page, or write a template. Like what I did for my website, see the footer of the page, there are a lot of outgoing links, the crawler can index those.
Why link something that you don't want to promote? Seems like odd behaviour. Your are promoting it, but then get spiteful? I can understand some very specific moments that something might need to be linked quietly and there is no intent for people to visit the page. But by and large, if someone is promoting something, pretending that they are not is weird. If you truly don't want it to be promoted, just don't link it.
-
@srinik said in How to Add rel="nofollow" to Links?:
But, you know as per SEO one should use nofollow tag for unnecessary links.
What's an unnecessary link? I think that the best approach is to eliminate unnecessary links, rather than linking and then trying to hurt their SEO after having utilized them as a reference.