ElkArte Community

Extending Elk => Addons => Addons ideas and questions => Topic started by: radu81 on February 26, 2016, 04:59:29 am

Title: Request - Nofollow attribute for external links
Post by: radu81 on February 26, 2016, 04:59:29 am
Hello,

I would like to set all my external links with "nofollow" attribute and the possibility to set which membergroups can add links without nofollow attribute. Is this difficult to code? There is nothing similar for SMF

In other forums nofollow to external links is enabled from default (wbb and XF)
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on February 28, 2016, 06:01:13 am
Arghh!!

I wanted to answer sooner, but I left it open on the other computer... :-[

It shouldn't be that difficult, just a search&replace of the current url bbcode implementation.
Title: Re: Request - Nofollow attribute for external links
Post by: Spuds on March 02, 2016, 08:58:17 am
I know we talked about doing this at least to signature / profile links by default.

Not sure about having it permission based so that some members links have nofollow and others don't ... could be done in parse bbc based on the post author id ... does XF do that?
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 02, 2016, 11:53:35 am
In Xenforo and WBB all external links are nofollow, messages and signatures. In xf you can use an addon to remove the nofollow attribute for some groups, don't know in WBB or other forums
Title: Re: Request - Nofollow attribute for external links
Post by: Joshua Dickerson on March 03, 2016, 10:42:39 pm
Quote from: Spuds – I know we talked about doing this at least to signature / profile links by default.

Not sure about having it permission based so that some members links have nofollow and others don't ... could be done in parse bbc based on the post author id ... does XF do that?
You'd need to get the permissions of the author. You'd want to do that before parse_bbc() to do a single query / cache request. A lot of work for something like this. Not sure anyone would want to make their site slower for nofollow on links.
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 06, 2016, 08:15:14 am
I understand it's not an easy task, but is possible to set all external links as nofollow and those I want to set without nofollow to insert manually using html code? I know is not the best solution, but I only need to set a few links without nofollow attribute
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 06, 2016, 08:56:01 am
Quote from: radu81 – In xf you can use an addon to remove the nofollow attribute for some groups,
Just because I'm very unfamiliar with XF: does that mean the group can be made allowed to post "follow" links?
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 06, 2016, 09:54:00 am
you can find all info here https://goo.gl/41cYkI
from default in XF only admins and moderators can post links bypassing the nofollow attribute, with that addon other membergroups may bypass the nofollow attribute. No "dofollow" attribute is added, only nofollow  attribute is removed
Screenshot from this addon:
(http://i.imgur.com/X4nCQPB.png)


Why I am asking this?
I sell a couple of banners and a couple of promotional article into my forum, not a big ammount but it covers a good part of my vps costs. Last year I received a good price even if my forum was less visited than it is now, this year the forum is almost 3 times bigger (users, topics, and number of visits in analytics). The offer I had this year is half than the precedent one because I have lots of external links. Here is the answer I received:

QuoteWell, our formula is mostly about the amount of domains linking to your website via direct and dofollow links. After that we consider "spam flags" from moz.com. Data from moz.com wasn't considered before, but now it affects budgets significantly, mostly due to the "Large Number of External Links" flag for sharkracingclub.it/ and skodaclub.it/. You can check this via this links https://moz.com/researchtools/ose/spam-analysis/flags?subdomain=www.skodaclub.it. So we don't even know the number of clicks/views and they are not being considered at all.

Since a similar addon will make me gain something I think this addon should be asked as paid.
Title: Re: Request - Nofollow attribute for external links
Post by: Joshua Dickerson on March 06, 2016, 01:09:53 pm
XF's BBC parser is very different (and better in most ways). It saves the post as a tree and then parses that. This allows it to do a lot of things that we can't a lot easier. I think it's slightly slower but not by much. Though, looking at what you posted, it seems it's not concerned with when viewing but only when posting.

So, a user could post without the permission and then later have it but the links don't change. Same with vice versa. I think this is pretty easy to do in the preparser even before 1.1's updated parser.

Are you saying you're willing to pay for it? If so, I can try to find some time to do it. I am looking for a job right now and moving so taking time to do something without getting paid is not really possible right now (also why I stopped developing recently).
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 06, 2016, 02:23:29 pm
Well, what I have in mind to do about that is (ab)use preparse code as usual: if you are allowed, you go, otherwise the nofollow is added as a parameter to url and that's all.
This approach has a couple of drawbacks of course:
1) removing or disabling the addon will destroy the links (restoring will need a maintenance task),
2) the editor bbc will require some adjustment because otherwise it may not recognize properly the new url.
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 06, 2016, 03:38:00 pm
I didn't test it much, it should work, but I'd test it on a test site, not live. O:-)

ETA: attachment removed.
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 06, 2016, 05:23:51 pm
Since I see one download I'll post it there so that its an "update". :P

The one attached here includes the replacement of the editor code, so that the new schema is recognized by the editor as well. :)

ETA: forgot to mention, it has also the permission.

ETA2: I forgot to mention another important thing, any old link is set as "nofollow", so if you have old links that should not be "nofollow", you have to edit the message and restore the "normal" url bbcode.

ETA: attach removed.
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 07, 2016, 06:47:47 pm
Sorry for the delay and thanks for watching into this. I tested the addon in localhost, but it was an imported smf so I choosed to start from a clean install.

http://sharkracingclub.it/elktest/index.php?topic=1
Here is what I did:
- created 2 users,
    - user "biguser" is in the group "nofollow" where I set the permission to post nofollow links
    - "user" is a regular user with ElkArte default permission

I tried to edit as admin my post and look the result http://sharkracingclub.it/elktest/index.php?topic=1.msg2#msg2

The text I wanted to insert is:
Code: [Select]
copy/pasted link: 

www.google.com

link inserted with url:

[url=http://www.google.com]Google[/url]

As I can see all links are nofollow and it breaks link for the special group and also for the admin.

if you want to test, both users are using the pass 123456
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 08, 2016, 02:33:15 am
I know part of that one! :D
I changed the code for a reason, but now I don't remember exactly what was the reason any more... :-[
So... let's just assume I was not in the right state of mind the other day and the one attached here is the correct package. O:-)

ETA: attachment removed.
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 08, 2016, 03:04:16 am
I confirm that links are not broken with this release, but I still see all links as nofollow, no matter if is a post from admin or from a user in the special group
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 08, 2016, 04:03:35 am
And now that I wake up completely, I see what I was aiming at with my previous code. xD
Ok, now I even wrote some unit testing to be sure what comes out is the expected behaviour (hoping not to have messed up the tests themselves LOL). So, the attached one should work as expected... I hope.
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 08, 2016, 04:39:28 am
is getting better  :D

it works for the urls inserted with URL bbcode, but not with direct links
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 08, 2016, 04:51:16 am
Which part is not working? O:-)
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 08, 2016, 05:01:39 am
the first 3 links http://sharkracingclub.it/elktest/index.php?topic=1.msg8#msg8
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 08, 2016, 05:58:44 am
Ahh okay, so even if the user is allowed, auto-linking doesn't get the "follow".
Yep, this is a limitation and there is no good way to fix it, so I let it pass.
There is no good way because the auto-linking happens at parse_bbc-time, so it cannot be checked without wasting "time" fetching all the users groups and permissions (quite a bit of work) on each and every parse_bbc (that by chance is not even that easy if we want to let it work in the future as well). Do the auto-linking at posting-time, on the other hand, is not easy either because it may breaks other stuff (e.g. video auto-embedding).
And since it's just a matter of wrap the url into and url tag I considered it not worth fixing. ;)
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 10, 2016, 04:51:25 am
Thank you Emanuele for all your help! Even if direct links (without url)  from admins and special group has the nofollow attribute this is not a big problem, if I really want to obtain a link without nofollow I have to use the url tag which is fine for me

Just one question, is it possible to not apply this addon for the links to my domain?

p.s. I saw a similar addon to other forum script which does the same thing but in a different way, no membergroups permission but only a whitelist of domains. So if a domain is in the whitelist, no matter who is posting the link, it will not have the nofollow attribute. Is this approach easier to implement into elkarte?
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 10, 2016, 07:45:33 am
sorry @derived but I don't understand
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 10, 2016, 08:21:00 am
This has nothing in common with attachments ;)
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 10, 2016, 12:12:22 pm
Quote from: radu81 – Just one question, is it possible to not apply this addon for the links to my domain?

p.s. I saw a similar addon to other forum script which does the same thing but in a different way, no membergroups permission but only a whitelist of domains. So if a domain is in the whitelist, no matter who is posting the link, it will not have the nofollow attribute. Is this approach easier to implement into ElkArte?
A white-list should be generally less of a problem and should be applicable at parse_bbc-time instead of preparsecode. That said, mix the two approaches could be less straightforward, but doable.
The only thing pending is that to be completely honest, I'm not sure it is worth the hassle. :P
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 10, 2016, 12:17:38 pm
@derived if I understood what you are proposing, I think it's not really related and probably it should be discussed more in details.
Let me try to recap: instead of an "hard" selection of allowed attachment extension (i.e. "this set of extensions is allowed, anything else is rejected"), you would like a kind of "soft" list (along the lines "this set of extensions is allowed, the rest are uploaded, but not downloadable directly, but via some kind of copy&paste thingy like google does for potentially dangerous websites").
Did I get it right?
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 10, 2016, 02:28:20 pm
Well I don't want to make you loose time on this, but probably there is another simpler way : set all links as no follow and remove the nofollow attribute only  for links inserted with iurl bbcode. I know it doesn't have much sense , but nobody is using the iurl code on my forum, I might say it's a hidden bbcode, not every script has this bbcode. That could be made with just a few edits, I understand I have to controll every update but is the quickest way. What do you think?

P. S. I'm not an expert in seo and I don't know if this will bring me any vantage, but if most forums are having nofollow links  into core from default (xf, wbb, kunena, vanilla,  bbpress) maybe worth some time to invest into this for the next releases 1.1.x or 2.0...
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 10, 2016, 03:12:23 pm
Quote from: derived – the attachment system is already designed to look at certain location, for certain identifiers

copy and split off that "system" so it works separately,
Attachments and bbcode are two different beasts entirely, the attachments check on extensions is just a "pick the last three chars of the string and compare". Easy.
URLs are 1) mixed in the text (so the first thing is to actually find the URL), 2) the domain is mixed in the string (there could be http, https, no http at all and only www, could be mail, ftp, several other variants.

The two problems are different enough not to be easily mixed. ;)
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 10, 2016, 03:44:34 pm
What is it mirc url catcher? :-[
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on March 10, 2016, 03:48:13 pm
Quote from: radu81 – Well I don't want to make you loose time on this,
Don't worry about that, if I work on something it's because I want to, otherwise I just let it slip through. :P

Quote from: radu81 – but probably there is another simpler way : set all links as no follow and remove the nofollow attribute only  for links inserted with iurl bbcode. I know it doesn't have much sense , but nobody is using the iurl code on my forum, I might say it's a hidden bbcode, not every script has this bbcode. That could be made with just a few edits, I understand I have to controll every update but is the quickest way. What do you think?
It's not that I don't know how to solve the problem even with the code at hand, it's just that now I'm not sure what you exactly want, so I'm wary at coding it in a way that is good to solve the problem in a certain way just to discover tomorrow, that the real goal was another and could have been implemented in a totally different way. :P
And it's not so hypothetical, because it's what happened just now: nofollow based on permissions require an approach, nofollow based on a white-list can be achieved much better in another way. You first asked for permissions, now for white-list. So, should I now mix the two approaches and have the worst possible scenario of complexity or should I just give up one of the two? And if the latter which one should I drop? ;)

iurl is another matter altogether. O:-)

Quote from: radu81 – P. S. I'm not an expert in seo and I don't know if this will bring me any vantage, but if most forums are having nofollow links  into core from default (xf, wbb, kunena, vanilla,  bbpress) maybe worth some time to invest into this for the next releases 1.1.x or 2.0...
Well, if we want to nitpick:
1) some of the most famous forums of the world (reddit, stackoverflow) don't even open new windows on each and every link,
2) another one (whose glory is actually in the past, 4chan) is not even creating clickable links out of URLs.

There is variety, I tend to dislike the nofollow, simply because if I link something, it means it's relevant somehow, and if something is relevant it should just get the recognition it deserves (and I tend to expect others do the same with my sites, but I'm pretty sure it's not the case... sigh).
Following the current (and last 5 years) trend, I guess in a couple of years nofollow will not be a problem because search engines google will not give a sh**t about links and just care about what it thinks it's important and all these discussions will be mood. :P

TL;DR: tell me what you want and let's make it a deal. ;)

Don't worry about what I posted, it's not against you, it's just that this evening I'm in a ranting mood. LOL
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on March 14, 2016, 06:08:28 am
I have to admit I did a mess in this topic and I escuse for that, was not my intention. As you can see lots of ideas and all confused  O:-)

What I am trying to obtain is to set all external links as nofollow and and allow links without nofollow atribute only for some domains. The "membergroup permission" is not really needed and in my case probably a whitelist could work better.

Could this be simplier than the previous addon with membergroup permission?

thank you in advance
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on April 05, 2016, 05:12:33 pm
sorry to bump this again, are there any news?  O:-)
Title: Re: Request - Nofollow attribute for external links
Post by: meetdilip on April 06, 2016, 05:57:59 am
Something I just found on internet

A video by Matt Cutts​

https://youtu.be/x4UJS-LFRTU​

Read more : https://support.google.com/webmasters/answer/96569?hl=en&ref_topic=4617741​
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on April 25, 2016, 05:19:02 am
I was looking into a simplified version of this, but I'm having a "design" doubt and I'd like to gather opinions.
What I'm trying to achieve:
1) nofollow at the board level,
2) optional nofollow for signatures.
So, give the possibility to create boards in which the nofollow attribute is applied and others where the nofollow attribute is not applied. This, in conjunction with an optional setting to add the nofollow to all the signatures would allow a rather fine grained control[1].

Now, the doubt is this one: the setting is one that goes into the create/edit board, but does it deserve a column in the boards table?
I'm a bit wary about it, because despite being a "board-level" setting, to me is something that would better served with just an entry in the settings table. On the other hand, a simple entry doesn't "sound" nice, but I'm not sure.

Opinions?
Basically permission-based because the board can have a control over who can post, yes, with all the limitations on answers and alike, but at least it's better than nothing. :P
Title: Re: Request - Nofollow attribute for external links
Post by: Spuds on April 25, 2016, 06:17:35 pm
I think it could be best handled as a board permission ... easy to set up a no-follow permission profile and apply as needed.
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on April 26, 2016, 04:09:51 pm
No problem for me to use board permission, but bbcode will change for nofollow links? Thanks Emanuele for not forgetting about this
Title: Re: Request - Nofollow attribute for external links
Post by: radu81 on May 22, 2016, 05:31:20 pm
Sorry to bump this again  O:-)
Title: Re: Request - Nofollow attribute for external links
Post by: emanuele on May 23, 2016, 09:44:51 am
Ouch... sorry, I completely lost that one... :-[

Spoiler (click to show/hide)
Title: Re: Request - Nofollow attribute for external links
Post by: Spuds on September 19, 2017, 07:16:06 pm
Moved addon to its own addon thread .. http://www.elkarte.net/community/index.php?topic=4682.0