Forums

Include a robots meta tag for pages without posts (2 posts)

  1. SteveDrum
    Member
    Posted 12 months ago #

    Hello.
    Just wondering if anyone can help out with this...
    i want to include a robots noindex meta tag for pages containing no posts.
    e.g, if someone visits a tag archive, and the tag has been deleted, then i don't want it indexed by google, so i want to put a noindex tag at the top.

    but i can't figure out how you can include it in the head, when the loop hasn't started yet.
    i've been reading up, and i reckon the solution has probably got something to do with have_posts(), but i can't work out how to actually implement it.

    if anyone has got some tips, that would be great.

  2. chaoskaizer
    Member
    Posted 12 months ago #

    If the tag archive has been deleted WP should return 404 page not a blank tag archive.

    I suggest you add a robots.txt rules so googlebot wont have to revisit the page.

    example -robots.txt

    User-agent: Googlebot
    Disallow: /blog/tags/the-deleted-tag-slugname

    Then you should validate the new robots.txt rules using google-webmaster tools. G bot should re-index your blog and exclude those uri.

Reply

You must log in to post.

About this Topic