Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
851 views
in Q2A Core by

q2a is adding nofollow-links to all posted URLs in:

1. qa-app-format.php: functions qa_html_convert_urls + qa_url_to_html_link, adding it as <a href="..." rel="nofollow">

For the last couple of months I used the workaround of displaying all posts while removing the rel="nofollow" attribute with preg_match.


Today I removed the nofollow directly from qa-app-format.php and assumed there would be nofollow attributes anymore, but there are!

As I am using the edit-history-plugin now, I can see what is going on in the database. It seems that the nofollow tag is added anyway, which makes me really wonder!

See revision example at: http://www.gute-mathe-fragen.de/revisions/1926

 

Can somebody enlighten me how to remove nofollow completely when a question is posted?

 

PS: Strange enough when posting the question the order is: <a rel="nofollow" href="link"> after editing the question and posting it again the order is: <a href="link" rel="nofollow"> ... just compare revision and original post (see html source "Funktionen").

PS2: I am using wysiwyig editor (CKeditor) but I could not find any line yet that says it is adding the nofollow tag...

1 Answer

+1 vote
by
edited by

Alright I found the answer:

In qa-htmLawed.php I commented out:

line 515: // if(!preg_match('`\bnofollow\b`i', $a['rel'])){$a['rel'] .= ' nofollow';}

line 518: else{ //eetv (no nofollow): $a['rel'] = 'nofollow';
        }


No there are no nofollow-links posted to the database anymore!

Update (easier):

1. open qa-base.php in qa-include/

2. comment out line 710 in $safe=htmLawed(...):
// 'anti_link_spam' => array('/.*/', ''), // do not set rel=nofollow

done

by
qa-htmLawed.php is a external class added to q2a to sanitize HTML, it will be updated in future q2a versions since it had already been update.
by
This worked for me, q2a version 1.8.2

The line is 1030 in qa-base.php in qa-include/

1030                 #'anti_link_spam' => array('/.*/', ''),
...