Putting noindex nofollow metatag in categories and archives in Wordpress

Discussion in 'WordPress' started by Mazakustrum, Jul 26, 2014.

  1. #1
    I know you can use php to do, but I'm wondering if simply pasting the meta tag in the header of category.php and archives.php page templates would work just as well since in order to create any category or archive pages those page templates are used.
     
    Mazakustrum, Jul 26, 2014 IP
  2. AlbCoder

    AlbCoder Well-Known Member

    Messages:
    126
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    163
    #2
    metatags are included in header.php before </head> so you cant add meta tags into your archive.php or category.php without using php because this files calls one header you must use wordpress functions or create another header2.php and include in templates with those metatags inside..
     
    AlbCoder, Jul 27, 2014 IP
  3. carrieathomer

    carrieathomer Greenhorn

    Messages:
    108
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    18
    #3
    If you use any of SEO plugin, you can set no index in the options for category and archives. Try seo yoast or all in one seo package
     
    carrieathomer, Jul 29, 2014 IP
  4. Mazakustrum

    Mazakustrum Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #4

    Oh I see. I haven't really looked at the page templates recently xD.

    Would this work?

     
    Mazakustrum, Jul 30, 2014 IP
  5. Mazakustrum

    Mazakustrum Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #5
    I'm also thinking
    would work. Not sure though. Kinda new to php.
     
    Mazakustrum, Jul 30, 2014 IP
  6. AlbCoder

    AlbCoder Well-Known Member

    Messages:
    126
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    163
    #6
    <?php if(is_home() ) {
    <meta name="robots" content="index follow">
    } else {
    <meta name="robots" content="noindex, nofollow">
    } ?>
    PHP:
    something like that you need to use else
     
    AlbCoder, Jul 31, 2014 IP
  7. Mazakustrum

    Mazakustrum Peon

    Messages:
    18
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    3
    #7
    Ah so I basically have to combine those two into one instead?

    Do you know how to do that by any chance?

    Thank you for your help
     
    Mazakustrum, Aug 4, 2014 IP