• Header.php has a code that outputs <!– ok google, index me! –> or <!– google, please ignore – thanks! –> in the top of every page. We wanted to remove this both to avoid printing unnecessary HTML and to avoid sending invalid information: most of the pages were displaying the comment for welcoming Google without any regard to robots.txt blocking all search engines.

    While removing the HTML comments we also decided to simplify the if clause. Original code starting from line 11 in header.php:

    <?php
    // Head that nasty "duplicate content" Google "feature" off at the pass.
    	if((is_single() || is_category() || is_page() || is_home()) && (!is_paged())){
    	?>
    	<!-- ok google, index me! -->
    	<?php
    	}else{
    	?>
    	<!-- google, please ignore - thanks! -->
    	<meta name="robots" content="noindex,follow">
    	<?php
    	}

    Simplified code without the else clause and HTML comments:

    <?php
    	// Head that nasty "duplicate content" Google "feature" off at the pass.
    	if ( is_paged() || ! ( is_single() || is_category() || is_page() || is_home() ) ) {
    		?><meta name="robots" content="noindex,follow"><?php
    	}

    The if clause was a bit tricky, but should have exactly the same functionality in both. Here’s the breakdown of the original:

    • Do not block the search engines if ! is_paged() AND any one of the list is true (list: is_single(), is_category() etc.)
    • Block the search engines if is_paged() OR none of the list are true.

    The new code has only the latter part since the first wouldn’t create an action. Code was formatted to match the WordPress Coding Standards.

    If someone would like to test this also on their site, that’d be great. If no one encounters any problems in a reasonable time frame, I’ll submit this into the Elbee Elgee repository for Doug to consider adding to the next update.

    http://wordpress.org/extend/themes/elbee-elgee/

Viewing 1 replies (of 1 total)
  • Theme Author Doug Stewart

    (@zamoose)

    I’ll consider it, but I think it may actually be plugin territory, thus I may well just remove that section entirely.

Viewing 1 replies (of 1 total)
  • The topic ‘[Theme: Elbee Elgee] [PATCH] Google "duplicate content feature" improvement’ is closed to new replies.