AIOSEO: How to fix duplicate title and description in paged comments

aioseo-fixed-comment-duplicate-title-descriptionWhen it comes to optimize your WordPress site for Search Engine, every details had to be considered. Not every pages indexed by search engines will bring value to your WordPress site’s SEO. Sometime you will encounter duplicated title and description tags when you enabled WordPress comments paged system. This situation is bad for your WordPress site’s SEO and will decrease the effected pages value in Search Engine.

Want to verify if you have duplicated title and description html tag? login to your Google webmaster tools, choose your site, browse to search appearance and go to HTML improvements tab. if you have the duplicated issue, the page in Google webmaster tools will show the results same as below.
webmaster-tools-duplicated-result
Upon further checking on which page resulted in this duplicated issue, here’s the page that cause the duplicated meta title and description issue.

pages-with-duplicated-title

As you can see, the duplicated issue come from the WordPress comment paged pages. If you’re using WordPress SEO plugin, All in one SEO, you can simply add this code into your theme’s functions.php.

Fixed AIOSEO Duplicated Title

[php]function dez_aioseo_paged_title($title) {
global $cpage;
if ( $cpage >= 1 && is_single() ) {
$title = $title . ‘ – Comment Page ‘ . $cpage;
return $title;
} else {
return $title;
}
}
add_filter( ‘aioseop_title_single’, ‘dez_aioseo_paged_title’ );[/php]

Fixed AIOSEO Duplicated Description

[php]function dez_aioseo_paged_desc($description) {
global $cpage;
if ( $cpage >= 1 && is_single() ) {
$description = $description . ‘ – Comment Page ‘ . $cpage;
return $description;
} else {
return $description;
}
}
add_filter( ‘aioseop_description_full’, ‘dez_aioseo_paged_desc’ );[/php]

With this fix, when you’re browsing paged comments, the title and description will have ‘ – Comment Page – %’ at the end.

Why the trouble for adding this? aren’t AIOSEO had built in SEO setting for paginated post/page?

Unlike paged post/page where the AIOSEO plugin add ‘ – Page %’ to your paged post/page. Paged comments are not included unfortunately…so this quick fix will definitely help you.

How to remove indexing of paged comments?

If you want to completely remove indexing of your paged comments, add this code to your theme’s functions.php.

[php]function dez_seo_for_comments() {
global $cpage, $post;
if ( $cpage >= 1 && is_single() ) {
echo "\n";
echo "<meta name=’robots’ content=’noindex,follow’ />";
echo "\n";
}
}
add_action( ‘wp_head’, ‘dez_seo_for_comments’ );[/php]

This tell the Search Engine not to index the paged comments but still allow to follow the link. This is useful you if have like 10,000 comments in single post which you certainly do not want Search Engine to index all paged comments that does not add any SEO value to your site.

Comments are closed.

Scroll to Top