WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#8919 closed enhancement (invalid)

previous_comments_link and next_comments_link needs nofollow to avoid duplicate content

Reported by: DarkPepe Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: Comments Keywords: comments, nofollow, has-patch, tested
Focuses: Cc:

Description

Hi, lots of users are reporting (including me) about a duplicated content problem generated on the paged comments feature.

Since each page reproduces the post content but displays the next/previous comments, google is picking the new permalink as a duplicated content page. Example:

www.site.com/post-name/
www.site.com/post-name/comment-page-2/

In those permalinks, google catches the content as duplicated regardless the extension and actual content of the comments.

http://www.wihe.net/wp-content/uploads/2009/01/google-webmaster.gif (spanish)

Both duplicated content and duplicated title tags are beeing detected by google's webmasters tools.

The solution I found are implementing nofollow via a denial string on robots.txt or evenadding a meta string for nofollow based on cpage function.

Probably the best solution will be to add a nofollow property directly on the comments_link function

wp-includes/link-template.php
@line 1277 (Public 2.7 Branch)

	echo '<a href="' . clean_url( get_comments_pagenum_link( $nextpage, $max_page ) );

Replace with:

	echo '<a rel="nofollow" href="' . clean_url( get_comments_pagenum_link( $nextpage, $max_page ) );

Then @line 1307:

	echo '<a href="' . clean_url(get_comments_pagenum_link($prevpage));

replace with:

	echo '<a rel="nofollow" href="' . clean_url(get_comments_pagenum_link($prevpage));

Well, probably you guys are way better programers than me and can come with a better solution for this.

Thank you!

Attachments (1)

comment-template.diff (866 bytes) - added by mrmist 7 years ago.
comment template add nofollow for comment permalinks.

Download all attachments as: .zip

Change History (13)

comment:1 follow-up: @filosofo7 years ago

The problem with this solution is that you're having search engine bots ignore all but the first page of comments.

In making the post content be an excerpt for all but one page of comments, my plugin's approach is more consistent with how many themes avoid duplicate content for archives, category, and search pages. And the comments themselves don't suffer the collateral damage of being ignored by Google.

comment:2 in reply to: ↑ 1 ; follow-up: @DarkPepe7 years ago

Replying to filosofo:

The problem with this solution is that you're having search engine bots ignore all but the first page of comments.

In making the post content be an excerpt for all but one page of comments, my plugin's approach is more consistent with how many themes avoid duplicate content for archives, category, and search pages. And the comments themselves don't suffer the collateral damage of being ignored by Google.

Is a very good solution imo, do you think google wont take the excerpt as duplicated content?

comment:3 in reply to: ↑ 2 ; follow-up: @filosofo7 years ago

Replying to DarkPepe:

do you think google wont take the excerpt as duplicated content?

Using excerpts to avoid duplicate content on WP archive pages is a long-running trick, advocated by many supposed SEO experts. In my experience, it seems to work.

comment:4 in reply to: ↑ 3 @DarkPepe7 years ago

Replying to filosofo:

Replying to DarkPepe:

do you think google wont take the excerpt as duplicated content?

Using excerpts to avoid duplicate content on WP archive pages is a long-running trick, advocated by many supposed SEO experts. In my experience, it seems to work.

Excelent! Im going for your solution then!, but we still need a built in fix for wp 2.8 I guess.

comment:5 @mrmist7 years ago

I think there probably should be a nofollow on the permalink that is generated for comments on the standard single-page template. Otherwise these links are almost entirely self-referencing / duplicate content. This would not affect the next / previous page links.

Attached one-line patch adds that.

@mrmist7 years ago

comment template add nofollow for comment permalinks.

comment:6 @mrmist7 years ago

  • Keywords has-patch tested added; removed

comment:7 follow-up: @DD327 years ago

That does however, Remove the ability for search engines to index the content of the extra comments.

The ability to enable/disable certain aspects of permalinks would be nice.. Ie. to allow /%postname%/?comment-page=34 However.. I don't think thats something that should be implemented on its own, but rather as a more far-reaching reorganisation, Something that might be better suited to plugins for the time-being.

comment:8 in reply to: ↑ 7 ; follow-up: @filosofo7 years ago

Replying to DD32:

That does however, Remove the ability for search engines to index the content of the extra comments.

I think mrmist's no-follow patch is just for the "link to this comment" part of the comment, not for the links to other comments pages.

comment:9 in reply to: ↑ 8 @mrmist7 years ago

Replying to filosofo:

I think mrmist's no-follow patch is just for the "link to this comment" part of the comment, not for the links to other comments pages.

Yep. The discussion prior to my patch had discounted the idea of a nofollow for the next and prev links, it seemed, but the permalinks also get picked up by google, so my quick and dirty patch was for that.

comment:10 @DD327 years ago

I think mrmist's no-follow patch is just for the "link to this comment" part of the comment, not for the links to other comments pages.

Oh.. Oops, Should read the back-chat next time.. I thought there was already a nofollow on the inline links..

comment:11 @mrmist6 years ago

  • Severity changed from major to normal

This was tested a while back, but is still current.

comment:12 @Denis-de-Bernardy6 years ago

  • Milestone 2.8 deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.