Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
DoFollow certain domains
Germont
New
I was happy that some domains linked from the forum increased traffic due to the new version of Vanilla.
Well, it couldn't be. I found in the source page that every external link is nofollowed, even without pop-up link.
Is there any solution to exclude nofollow for certain external domains?
Thank you!
0
Comments
rel="nofollow" does not exist in the database! Meaning it's added on the fly, at every page request
I don't think it would be possible to do that without touching core files.
Look at the Format class, especially those two blocks:
and
A plugin could change the way links are tagged, but only on a per-body basis, not on a per link basis.
You could insert a fireEvent call before
$nofollow = (self::$DisplayNoFollow) ? ' rel="nofollow"' : '';
, passing in the link url so tha you can hook into it.It might be more simple to work with JavaScript in this case and this plugin would be a good starting point.
/\
there is an event there
that mean you could use the hook
format_links_handler
it is after the fact, but you could still do a preg_replace on$mixed
grep is your friend.
Unfortunately my php skills are limited to changing values from 'true' to 'false', or searching for a missing semicolon.
I suppose Vanilla premium clients use a version with more basic features like opening links in new tab without configuring a plugin, or favoring your sites on your own forum. Or at least I hope they do.
I changed
public static $DisplayNoFollow = true;
to false, removed the line$nofollow = (self::$DisplayNoFollow) ? ' rel="nofollow"' : '';
and the attribute it's still there.Oh please don't do it like that! Get the [example plugin](https://github.com/vanilla/addons/tree/master/plugins/example and start with that.
1. Read the little bit that is needed to name it correctly
2. In the example plugin file delete everything that is in the curly braces from the class
3. Add the following code between the braces:
That's the start. You would have to find out about regular expressions in order to change the behaviour the way you like it and that is not too easy but you can alwaays ask...
I tried this and it does not work.
I'm pretty confident that it can be done via injected jQuery... There are some plugins that inject jquery, so you can research their source and find which hook to use for the injection.
It's a different approach than the one suggested by R_J (but I think his method should also work).
What @R_J posted should work. Just use $sender->EventArguments instead of $args if you are modifying event arguments (this changed some time ago unfortunately). <- in this case, it still works
Please post your plugin code, so we can help you, @ptoone
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
I want to retract my alternate suggestion to use jquery. While it can be used to add attributes to the HTML tag in question, it wouldn't necessarily yield the desired effect because the addition of the rel=nofollow will be done at the client side and it is not guaranteed that web crawlers will see that addition.
Bottom line - ignore the suggestion. Use @R_J method.