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

q2a v1.5.1/1.5.2 is adding the rel=nofollow to links - when posting a question / answer - and saves it to the database.

This led to workarounds of removing nofollow-attributes and core hacking. And needed mysql queries to remove nofollow from all posts.

In my opinion it would be better to not add this attribute when posting, but instead add it when loading the content from the database using str_replace or approriate php features.

 

PS: This would also save a bit of database storage ;)

Q2A version: 1.5.1
by
under development plugin: https://github.com/Towhidn/q2a-seo-links
add this options+you can add as many rules as you need to configure rel value.
by
Thanks towhid. I would like to see the q2a core having links untouched, and then plugins adding stuff to the <a> tags. I think this is the way to go. Let's see what gidgreen says :)

1 Answer

0 votes
by

I will add a parameter to function qa_sanitize_html() that specifies whether the HTML sanitization is for storage or for display. This will make it easy to develop a plugin which overrides this function and modifies the rules as appropriate. I personally think that rel=nofollow should also be stored in the database, and not just added at display time, but this will enable other rules to be applied.

by
Dear gidgreen, hmm, again another plugin... ?

Things to consider:
1. Why do we touch posted data?
2. What if rel=nofollow will change in the future (let it be substituted by a new tag) -> imagine the extra work for all the forums to come!
3. A lot of search engines ignore nofollow anyways.
4. additional storage of rel="nofollow"
5. all the trouble people have who do not want to be dictated a nofollow :) -> core hacks / workarounds (plugins)

I see the following (easiest way):
- rel=nofollow is added by php (if 'a href') { '<a rel="nofollow" href';}
- but only if a (new) option in the admin panel is ticked (under >admin >spam)

maybe somebody reading this proposal likes to confirm?
by
edited by
Well, it could be similar to the option in >admin >Viewing "Open linked URLs in a new window". Which adds a target="_blank" to every link from the untouched db-post, it is optional ;)

PS: If it stays like it is now, it is fine. The core hack requires only commenting out 4 lines.
...