Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#34890 closed defect (bug) (fixed)

Canonical meta tag for paginated posts incorrect with ugly permalinks

Reported by: peterwilsoncc Owned by: wonderboymusic
Priority: normal Milestone: 4.4.1
Component: Canonical Version: 4.4
Severity: normal Keywords: has-patch has-unit-tests fixed-major
Cc: Focuses:

Description (last modified by peterwilsoncc)

Following [34496] canonical URLs of paginated posts with ugly permalinks are incorrect.

Page http://example.com/?p=1&page=2
Canonical meta tag: <link rel="canonical" href="http://example.com/?p=1/2" />.

Going the canonical URL loads the first page.

Note: title updated to reference meta tag

Attachments (2)

34890.diff​ (700 bytes ) - added by peterwilsoncc 11 years ago.
34890.2.diff​ (2.5 KB ) - added by peterwilsoncc 11 years ago.

Download all attachments as: .zip

Change History (12)

@peterwilsoncc
11 years ago

#1 @peterwilsoncc
11 years ago

  • Keywords has-patch added; needs-patch removed

34890.diff​ corrects canonical URL for paginated posts:

  • Never adds pagination for the first page
  • Uses the page querystring if pretty permalinks are not set

Adapted from the code in _wp_link_page.

#2 @peterwilsoncc
11 years ago

  • Description modified (diff)
  • Summary Canonical URLs for paginated posts incorrect with ugly permalinks → Canonical meta tag for paginated posts incorrect with ugly permalinks

This ticket was mentioned in ​Slack in #core by peterwilsoncc. ​View the logs.


11 years ago

#4 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review → 4.4.1

#5 @SergeyBiryukov
11 years ago

  • Keywords needs-unit-tests added

#6 @peterwilsoncc
11 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed

34890.2.diff​ includes unit tests for paginated posts both with and without pretty permalinks.

Let me know if the tests needs rewriting, moving or both, it's my first attempt at unit tests.

#7 @jorbin
11 years ago

  • Owner set to wonderboymusic
  • Status new → assigned

@wonderboymusic, @joostdevalk - this was introduced in [34496] which both of you worked on, can you take a look?

#8 @dd32
11 years ago

  • Resolution → fixed
  • Status assigned → closed

In 36096:

Canonical: Output correct canonical links for paged posts when not using pretty permalinks.

Props peterwilsoncc.
Fixes #34890

#9 @dd32
11 years ago

  • Keywords fixed-major added
  • Resolution fixed
  • Status closed → reopened

#10 @dd32
11 years ago

  • Resolution → fixed
  • Status reopened → closed

In 36103:

Canonical: Output correct canonical links for paged posts when not using pretty permalinks.

Merges [36096] to the 4.4 branch.
Props peterwilsoncc.
Fixes #34890.

Note: See TracTickets for help on using tickets.