WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#21579 closed defect (bug) (fixed)

Canonical links in paged comments should point to themselves

Reported by: beaulebens Owned by: westi
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.4.1
Component: Canonical Keywords: has-patch
Focuses: Cc:
PR Number:

Description

Currently, the rel=canonical links inserted into posts/pages always point to the single-post/page view of that content. When comments are paged, this means

http://example.com/post/comment-page-3/

will have the rel=canonical of

http://example.com/post/

That means any comments past the first page will never be indexed by compliant search engines, because they will look to the rel=canonical and thus treat all comment pages as duplicate content.

All comment pages after the first should probably use their own URL for the canonical, e.g.

http://example.com/post/comment-page-x/

Attachments (1)

21579.patch (419 bytes) - added by jkudish 7 years ago.

Download all attachments as: .zip

Change History (9)

@jkudish
7 years ago

#1 @jkudish
7 years ago

  • Cc joachim.kudish@… added
  • Keywords has-patch added

Attached patch makes it so that all comment pages after the first use their own URL for the canonical as per beaulebens' explanation above.

#2 @westi
7 years ago

  • Milestone changed from Awaiting Review to 3.5

#3 @yoavf
7 years ago

  • Cc yoavf added

#4 @dllh
7 years ago

  • Cc daryl@… added

#5 follow-up: @dllh
7 years ago

This patch works for me, but it may be worth noting that the All-in-One SEO Pack plugin removes the action and replaces it with its own, causing me to spend a few minutes scratching my head over why the patch didn't work. Doubt that's much of a consideration, though.

#6 in reply to: ↑ 5 @westi
7 years ago

Replying to dllh:

This patch works for me, but it may be worth noting that the All-in-One SEO Pack plugin removes the action and replaces it with its own, causing me to spend a few minutes scratching my head over why the patch didn't work. Doubt that's much of a consideration, though.

Yeah, AIO replaces rel_canonical with it's own implementation so this won't work on a site that has the plugin activated.

#7 @westi
7 years ago

  • Owner set to westi
  • Resolution set to fixed
  • Status changed from new to closed

In [21571]:

When comment paging is enabled make sure to have canonical links for each of the comment pages so that all the comments are indexed instead of just the ones that are displayed on the permalink itself.
Fixes #21579 props jkudish.

#8 @mdgl
7 years ago

A similar (and probably more serious) problem occurs with paged singular content (i.e. that created through the <!--nextpage--> tag). See #11694 which unfortunately overloads the rel="canonical" issue with that of issuing 404s for non-existent pages. Do we need new tickets or can this one be used to fix both problems with rel="canonical" and #11694 used to fix both problems with the generation of 404s?

Note: See TracTickets for help on using tickets.