[wp-trac] [WordPress Trac] #49220: rel_canonical generates the wrong canonical structure for paginated pages.

WordPress Trac noreply at wordpress.org
Fri Jan 17 22:04:49 UTC 2020


#49220: rel_canonical generates the wrong canonical structure for paginated pages.
--------------------------+------------------------------
 Reporter:  bradleyt      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Canonical     |     Version:  4.6
 Severity:  normal        |  Resolution:
 Keywords:  close         |     Focuses:
--------------------------+------------------------------

Comment (by bradleyt):

 @SergeyBiryukov, thanks for getting back to me.

 First thanks for clarifying that posts using `<!--nextpage-->` don't have
 the /page/ url segment. I didn't know this and so that explains some of
 the reasoning behind the `rel_canonical` behaviour.

 However, I do still belive that there is an issue here unrelated to the
 WordCamp site. Any page in a WordPress installation can be accessed at
 {page slug}/page/{number}, despite that pagination structure being
 intended for archives. In these cases the canonical url is wrong.

 For example, look at the canonical meta tag on these non-wordcamp pages:
 https://wordpress.org/page/2/
 https://wordpress.org/showcase/page/2/

 Its worth noting that whilst these pages generally show the same content
 as the true canonical version, I frequently see themes & plugins building
 custom pagination for pages using this url structure. Therefore, to
 maintain backwards compatibility we must not remove these url structures
 (either by 404'ing or redirecting).

 It seems like `rel_canonical` needs some extra checks to differentiate
 between the two pagination types - when not in a `<!--nextpage-->` context
 the canonical should be equal to page 1.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49220#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list