ThemeShaper Forums » Thematic

[closed]

remove 'noindex' from category pages

(5 posts)
  • Started 2 years ago by edensun
  • Latest reply from ScottNix
  • This topic is not resolved
  1. edensun
    Member

    Hello. After rummaging around in thousands of themes, i have finally found the one i like. I use thematic with the power blog child theme

    I want to remove the "noindex" attribute from category pages. Currently the source on my category pages shows <meta name="robots" content="noindex,follow" />

    Doing some research I found that in /library/extensions/header-extensions.php there is thematic_create_robots filter in which this code lives (thanks to helgatheviking)

    Now, I know i have to do something in my functions.php file in my child theme(power blog) to make this work. Any help would be appreciated.

    p.s. I am a php newbie.

    Thanks very much

    Eden

    Posted 2 years ago #
  2. edensun
    Member

    hey guys. can anyone please help me with this? I don't mean to be pushy but don't want my post to be forgotten.

    Thanks

    I really appreciate your time

    Posted 2 years ago #
  3. Ok, this will change the noindex, nofollow meta to index, follow on the categories.

    // remove the index and follow tags from main pages and allow categories to be indexed
    function childtheme_create_robots($content) {
    	if (thematic_seo()) {
    		if((is_home() && ($paged < 2 )) || is_front_page() || is_single() || is_page() || is_attachment()) {
    		    $content = "";
    		} elseif (is_search()) {
    		    $content = "\t";
    			$content .= "<meta name=\"robots\" content=\"noindex,nofollow\" />";
    			$content .= "\n\n";
    		} elseif (is_category()) {
    		    $content = "\t";
    			$content .= "<meta name=\"robots\" content=\"index,follow\" />";
    			$content .= "\n\n";
    		} else {
    		    $content = "\t";
    			$content .= "<meta name=\"robots\" content=\"noindex,follow\" />";
    			$content .= "\n\n";
    		}
    	return $content;
    	}
    }
    add_filter('thematic_create_robots', 'childtheme_create_robots');

    This snippet will actually do one more thing too... It removes the "index, follow" tag from normal pages. Why? Because by default a page is already index, follow, so having it actually in the meta is redundant and just adds an extra line of code for no reason, so for cleanliness of code, I removed it.

    Posted 2 years ago #
  4. edensun
    Member

    Thanks ScottNix. Appreciate it a lot man. I am assuming that this gets pasted in my functions.php file?

    Posted 2 years ago #
  5. Yup, you are correct, functions.php :)

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.