1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How To Automatically Open External Links in a New Page And Set The Nofollow Tag in Blogger

Discussion in 'Blogging' started by bobymax909, Aug 9, 2018.

  1. #1
    External links One of the inevitable components of blogging is to explain or download a file but there are two problems associated withexternal links:

    • Open the link in blog window and this makes the visitor leave the blog and may still be reading
    • External links become Dofollow which negatively affects the blog that has its most presence
    Of course, there is a manual way to make external links open in a new page, which is to be given the Nofollow tag An example of a link will open in a new page with a Nofollow tag :
    SEMrush
    <a href='#'target="_blank"rel="nofollow">Example</a>
    Code (markup):
    The manual method is the best, you do not need to install the codes.But there are those who did not know those things and his blog is full of links and can not modify them all, So The solution is to put this code in your Template:

    Step 1: Go To Blogger.com>>Template>>Edit Template
    search for the</body>tag and copy paste the code bellow before it
    <script type='text/javascript'>
    $(document).ready(function() {
    $("a[href^='http://']").each(
    function(){
    if(this.href.indexOf(location.hostname) == -1) {
    $(this).attr('target', '_blank');
    $(this).attr('rel', 'nofollow');
    }
    }
    );
    $("a[href^='https://']").each(
    function(){
    if(this.href.indexOf(location.hostname) == -1) {
    $(this).attr('target', '_blank');
    }
    }
    );
    });
    </script>
    Code (markup):
    That's All,
     
    bobymax909, Aug 9, 2018 IP
    SEMrush