Support » Plugin: Title and Nofollow For Links » Even when nofollowed, check box not checked

  • Resolved whistlerdan

    (@whistlerdan)


    I have noticed that if you check the box for nofollow and then save the post, when you then edit the link again, the check box for nofollow is not checked.

    However, if you view the html source, you can see that the rel=nofollow tag has been added, but it’s not possible to check this using the link edit popup.

    It almost have me a heart attack because inspecting all my links with the editor it made it look like they hadn’t been nofollowed!

Viewing 8 replies - 1 through 8 (of 8 total)
  • @whistlerdan is right.

    When the link is set to open in a new window, TinyMCE (the WordPress default editor) adds automatically the value rel=”noopener”.

    In order to check/uncheck the “nofollow” checkbox, the plugin search for the exact string “nofollow” into the rel attribute value, but with the presence of the “noopener” value the comparison return false and the checkbox is not checked.

    In the nofollow.min.js code should be changed the following condition:

    instead of
    if (h.dom.getAttrib(k, "rel") === "nofollow") {

    should be used
    if (h.dom.getAttrib(k, "rel").indexOf("nofollow") >= 0) {

    With this small code modification, the checkbox is correctly checked/unchecked

    I hope it helps

    Luca

    • This reply was modified 2 years, 7 months ago by themagnifico.

    fixed, thanks.

    Could you please also add support for the noopener attribute (when target=blank is checked). This resolves a possible security issue for session hijacking.
    https://developers.google.com/web/tools/lighthouse/audits/noopener

    The rel=”noopener” tag should be added automatically by TinyMCE (the WordPress default editor) when the “Open link in a new window/tab” option is checked

    Last fix of the 4.6.3 version (implemented in WP 4.8.x)

    FIXED so rel on target=_blank links gets forced with only noopener instead of both noopener and noreferrer.

    https://www.tinymce.com/docs/changelog/#version463-may302017

    Yes, but we use the html editor exclusively 🙂 (which is also why we use this plugin)

    I have investigated a bit the issue and it seems that the problems of the plugin could arise from using a modified outdated version of the wplink.js file.

    List of the last commits of the wplink.js file:
    https://github.com/WordPress/WordPress/commits/master/wp-includes/js/wplink.js

    This implies the presence of some javascript error and not all the functions can work as expected.

    Unfortunately, the plugin contains only the minified version of the modified JS file.

    It would be nice to have also the “un-minified” version of the plugin modified script, in order to implement the original modifications to the updated wplink.js file

    • This reply was modified 2 years, 7 months ago by themagnifico.
    • This reply was modified 2 years, 7 months ago by themagnifico.

    you can use any unminify site like http://unminify.com/

    Thanks, @flector

    The problem is not the removing of white space characters, new line characters and comments, but the variable and function names that are all changed into a single letter without any particular meaning.

    For example,
    Original script file (~700 lines):

    var wpLink;
    
    ( function( $ ) {
    	var editor, searchTimer, River, Query, correctedURL,
    		inputs = {},
    		rivers = {},
    		isTouch = ( 'ontouchend' in document );
    
    	function getLink() {
    		return editor.dom.getParent( editor.selection.getNode(), 'a' );
    	}
    ...
    
    

    Unminified script file:

    var wpLink;
    (function(e) {
        var h, c, a, f, j, g = {},
            d = {},
            b = ("ontouchend" in document);
    
        function i() {
            return h.dom.getParent(h.selection.getNode(), "a")
        }
    ...
    

    If the not uglified version is not available, nevermind. 🙂
    Thanks anyway 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Even when nofollowed, check box not checked’ is closed to new replies.