Dynamic meta robots
I am trying to find the best way to create a dynamic meta robots section. I have a search engine and only want the main search "with all categories searched together" indexed by google and others. I want any category searches to be NOINDEX so I do not get duplication penalties for possibly having alot of the same text showing on a different search page. I made it so if "category" is in the url to make it NOINDEX like this.
<?php if (!isset($_GET['category'])) echo "<meta name='robots' content='all'>"; if (isset($_GET['category'])) echo "<META NAME='ROBOTS' CONTENT='NOINDEX, NOFOLLOW'>"; ?>
It seems to work fine this, it makes the normal search have this开发者_如何学Python meta robots
<meta name="robots" content="all">
And if any category is searched the meta robots look like this
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
Just wondering if this the best way to do this? Anyone have any suggestions? Thanks.
EDIT: I am assuming that since no one has replied that this is the way to go. Hope this possibly helps someone else someday. Thanks for viewing.
Using noindex
is the right way to prevent search engines from indexing that specific page.
But why are you using nofollow
? You tell the search engine to not follow the links on that page. Is there a reason why you're doing that? If not, you could remove the nofollow
part.
yes, this is fine way to do it. I see no problem in that.
精彩评论