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

WordPress Trac noreply at wordpress.org
Fri Jan 17 17:31:20 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        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 `rel_canonical` is responsible for generating canonical permalink
 structures for pages. For example, when visiting the WordPress.org
 homepage, the canonical permalink is set to `https://wordpress.org/`.

 `rel_canonical` has some built in handling of paginated page structures,
 but this does not seem to be doing the correct thing.

 A paginated page has the url structure of `https://example.com/page/2`.
 However, on this page the canonical tag would be output as:

 `<link rel="canonical" href="https://example.com/2/" />`

 As well as simply being wrong, this can conflict with WordPress's
 `wp_guess_url` functionality. For example,
 https://central.wordcamp.org/page/5/ canonicalises to
 https://central.wordcamp.org/5/, which when visited redirects to the "5
 -reasons-you-should-attend-wordcamp-nyc" post (due to the presence of "5"
 in the slug). I would imagine this could seriously confuse some search
 engines.

 This situation is made worse by the fact that only a small proportion of
 pages created through WordPress have legitimate pagination. In these cases
 the page should canonicalise to the first page, but I believe handling of
 non-paginated pages would be better considered in a separate ticket.

 This has come to light as a result of the following meta tickets which are
 contributing to the current SEO issues on wordpress.org:
 https://meta.trac.wordpress.org/ticket/4198
 https://meta.trac.wordpress.org/ticket/4564

 This bug is only affecting sites with pretty permalinks enabled.

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


More information about the wp-trac mailing list