[wp-trac] [WordPress Trac] #50163: Perform a canonical redirect when paginated states of the front page are not found

WordPress Trac noreply at wordpress.org
Wed Sep 25 18:20:10 UTC 2024


#50163: Perform a canonical redirect when paginated states of the front page are
not found
-------------------------------------------------+-------------------------
 Reporter:  dd32                                 |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.7
Component:  Canonical                            |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-screenshots early      |     Focuses:
  has-unit-tests has-testing-info                |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * keywords:  has-patch has-screenshots early has-unit-tests => has-patch
     has-screenshots early has-unit-tests has-testing-info


Comment:

 == Test Report

 Patches tested:
 * https://github.com/WordPress/wordpress-develop/pull/6421 which includes
 [https://github.com/WordPress/wordpress-develop/pull/270 PR 270] (for the
 source code changes) and unit tests.

 === Steps to Reproduce or Test

 Set up steps:
 1. Set the static Home page by:
    * Go to Settings > Reading Settings.
    * Select "A static page (see below)".
    * Set the Homepage to "Sample Page".
    * Click / trigger "Save Changes" button.
 2. Add the `<!--nextpage-->` to the Sample Page by:
    * Go to Pages > Sample Page.
    * Add the "Page Break" block to the content. For example:
       * Click/trigger the  "Add Block" + UI below the first quote, type
 "Page Break", click on the block to add it.
       * Or in the Code Editor version, copy and paste this code below the
 first `wp:quote`:
 {{{
 <!-- wp:nextpage -->
 <!--nextpage-->
 <!-- /wp:nextpage -->
 }}}
       * Click/trigger the Save button.

 Testing Instructions (after completing the setup):
 1. Go to the root of the front-end, i.e. the static homepage.
 2. Click on the `2` in the pagination or add `/page/2/` to the browser's
 URL.
 3. Change the `/page/2/` to `/page/3/` in the browser's URL. 🐞 Bug
 occurs.

 === Expected Results

 When testing a patch to validate it works as expected:
 - ✅ Step 2: `/page/2/` should show the rest of the Sample Page's content
 and set the pagination such that `1` is now linked.
 - ✅ Step 3: `/page/3/` (which does not exist) should redirect to the
 static homepage's root URL, e.g. `http://localhost:8889`, show the first
 part of the Sample Page's content, and set the pagination such that `2` is
 linked.

 When reproducing a bug:
 - ✅ Step 2: `/page/2/` should show the rest of the Sample Page's content
 and set the pagination such that `1` is now linked.
 - ❌ Step 3: `/page/3/` (which does not exist) does not redirect, i.e. the
 error condition occurs.

 === Environment

 * Localhost: `npm run env` setup (Docker)
 * Browser: Firefox 130.0.1
 * WordPress: 6.6.2 and 6.7-alpha-58576-src
 * PHP: 8.2
 * OS: macOS

 ==== Actual Results
 When reproducing a bug/defect:
 - ✅ Step 2: `/page/2/` did properly show the Sample Page's remaining
 content and the pagination was correct.
 - ❌ Step 3: `/page/3/` (which does not exist) did not redirect.

 When testing the bugfix patch:
 - ✅ Step 2: `/page/2/` should show the rest of the Sample Page's content
 and set the pagination such that `1` is now linked.
 - ✅ Step 3: `/page/3/` (which does not exist) did redirect to root URL
 which rendered the first part of the Sample Page's content with the
 expected pagination.

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


More information about the wp-trac mailing list