Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1069486

    Hi
    You should add rel=”noopener noreferrer” on all links with target=”_blank”

    https://developers.google.com/web/tools/lighthouse/audits/noopener

    #1069855

    Hey enestedt,

    Thanks for sharing, have we missed adding that somewhere?

    Best regards,
    Rikard

    #1069905

    But please read carefully.

    Recommendations

    Add rel=”noopener” or rel=”noreferrer” to each of the links that Lighthouse has identified in your report. In general, when you use target=”_blank”, always add rel=”noopener” or rel=”noreferrer”.

    Or : means – nofollow will be enough to add.

    btw: you can reach this via child-theme functions.php
    adjust the webers-testseite.de through your home domain url:

    add_action('wp_footer', 'open_external_links_in_newtab');
    function open_external_links_in_newtab(){
    ?>
    <script type="text/javascript">
    (function($) {
    	$('a').not('a[href*="webers-testseite.de"]').attr({
    		'target':'_blank',
    		'rel': 'nofollow',
    	})
    })(jQuery);
    </script>
    <?php
    }

    means that any link that does not match your domain url will be considered external and will be opened in a new tab with the attribute nofollow.

    #1069912

    Hi Rikard
    I downloaded the theme 20/2 2019 and in that theme files I get a lot of taget _blank, maybe you can look in to them and see if its necessary track where the link comes from.
    But the one I’m most concerned about is the social links added via the theme settings (social profiles).
    It would be nice if those links had noopener and/or noreferrer, at least an option for me as a user to add me own rel options :)


    @Guenni007

    I still want google to follow the social links so nofollow is out of the question.
    But I don’t want someone to “hijack” the site
    https://support.performancefoundry.com/article/186-noopener-noreferrer-on-my-links

    #1069917

    ok – take this code to child-theme functions.php:

    add_action('wp_footer', 'open_external_links_in_newtab');
    function open_external_links_in_newtab(){
    ?>
    <script type="text/javascript">
    (function($) {
    	$('a').not('a[href*="webers-testseite.de"]').attr({
    		'target':'_blank',
    		'rel': 'nofollow noreferrer',
    	})
    })(jQuery);
    </script>
    <?php
    }

    but read on your link above : Collateral damage and https versus http

    so it might be better to only do this to links which starts with http only:

    add_action('wp_footer', 'open_external_links_in_newtab');
    function open_external_links_in_newtab(){
    ?>
    <script type="text/javascript">
    (function($) {
    	$('a[href^="http:"]').not('a[href*="webers-testseite.de"]').attr({
    		'target':'_blank',
    		'rel': 'nofollow noreferrer',
    	})
    })(jQuery);
    </script>
    <?php
    }
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.