Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Christine 115 posts 288 karma points
    Feb 03, 2017 @ 20:43
    Christine
    0

    Using a checkbox to display a meta robots nofollow tag

    I would like to offer a checkbox in the back office to add the meta robots nofollow tag in the head if checked.

    I chose a true false document type, but I'm not sure how the code should look in the master page. I tried this, but it didn't work:

    @{
            if (CurrentPage.HasValue("robotsNoFollow"))
            {
                <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
            }
        }
    

    Any help? TIA!

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 03, 2017 @ 22:55
    Chriztian Steinmeier
    103

    Hi Christine,

    This snippet works for me:

    @if (CurrentPage.HasProperty("robotsNoFollow") && CurrentPage.robotsNoFollow == true) {
        <meta name="robots" content="noindex, nofollow">
    }
    

    Hope that helps,

    /Chriztian

  • Christine 115 posts 288 karma points
    Feb 06, 2017 @ 14:44
    Christine
    0

    Thanks so much Chriztian, that worked!

  • Henrik Vincent 122 posts 616 karma points
    Mar 15, 2018 @ 08:07
    Henrik Vincent
    0

    You could use this as well, if you want some more control over which tag to insert.

    @if(CurrentPage.GetPropertyValue("noindex") == true && (CurrentPage.GetPropertyValue("nofollow") == true)){
             <meta name="robots" content="noindex,nofollow">
        }
        else if(CurrentPage.GetPropertyValue("noindex") == true && (CurrentPage.GetPropertyValue("nofollow") == false)){
             <meta name="robots" content="noindex,follow">
        }
        else if(CurrentPage.GetPropertyValue("noindex") == false && (CurrentPage.GetPropertyValue("nofollow") == true)){
             <meta name="robots" content="index,nofollow">
        }
        else{
             <meta name="robots" content="index,follow">
        }
    
  • Simeon Ostberg 123 posts 389 karma points
    May 28, 2018 @ 10:48
    Simeon Ostberg
    0

    Hi!

    Please excuse my question to this older thread, however I was wondering, what I have to do to exclude a certain page from indexing and following?

    "noindex" will work as described, but "nofollow" will only handle outgoing links from this page. How would it work to add a

    rel="nofollow"
    

    to all links to this page?

  • Henrik Vincent 122 posts 616 karma points
    May 28, 2018 @ 12:02
    Henrik Vincent
    0

    Hi Simon

    To exclude a page from indexing and following you should add the following to your page' <head></head> section.

    <meta name="robots" content="noindex,nofollow">

    rel="nofollow" on a specifik link just tells search engines to not follow that specific link. Even though they'll still follow it, it sends a signal, that you don't "trust" the link with the nofollow added.

    Hope this helps :)

    Best

    Henrik

  • Simeon Ostberg 123 posts 389 karma points
    May 28, 2018 @ 12:10
    Simeon Ostberg
    0

    Hi Henrik,

    But I understand, that "nofollow" keeps the crawlers from following the links on this respective page. I would like to prevent the crawlers from coming to this respective page. Or am I wrong?

    However, I understand your point with the trust, so I'll just go with "noindex" :)

    Best, Simeon

  • Henrik Vincent 122 posts 616 karma points
    May 28, 2018 @ 13:08
    Henrik Vincent
    1

    Hi again Simeon

    I you wanna prevent the crawlers from visiting the page completely, your should do a disallow in your robots.txt file instead.

    But if the page is already indexed, you need to get it out of the index first, before blocking it in the robots.txt file, since the robots.txt disallow tells the search engines to stay away from the disallowed page completely.

    If the page isn't indexed you can add the following to your robots.txt file which should be placed in the root directory of your FTP.

    User-agent: *

    Disallow: /page-you-dont-want-indexed

    But let me know what kind of page you're wanting the crawlers to stay away from, then I can get a better idea whether you should noindex or Disallow in robots.txt :)

    Best

    Henrik

Please Sign in or register to post replies

Write your reply to:

Draft