WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/04/2020 10:40:06 AM (21 months ago)
Author:
SergeyBiryukov
Message:

Canonical: Redirect paged requests for a static page assigned as the "Posts page".

This avoids displaying duplicate content of the home page under different URLs with appended page numbers.

This change only affects the <!--nextpage--> pagination (page query variable) and not the regular multiple posts pagination (paged query variable).

The posts page does not support the <!--nextpage--> pagination, so requests for invalid page numbers should be redirected to the page permalink, applying the logic previously implemented for single posts or pages.

Follow-up to [34492], [47727].

Props jeremyfelt, sachit.tandukar, SergeyBiryukov.
Fixes #45337. See #40773, #28081, #11694.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/canonical/pageOnFront.php

    r47122 r47760  
    5959            // The page designated as the front page should redirect to the front of the site.
    6060            array( '/front-page/', '/' ),
     61            // The front page supports the <!--nextpage--> pagination.
    6162            array( '/front-page/2/', '/page/2/' ),
    6263            array( '/front-page/?page=2', '/page/2/' ),
     64            // The posts page does not support the <!--nextpage--> pagination.
     65            array( '/blog-page/2/', '/blog-page/' ),
     66            array( '/blog-page/?page=2', '/blog-page/' ),
     67            // The posts page supports regular pagination.
    6368            array( '/blog-page/?paged=2', '/blog-page/page/2/' ),
    6469        );
Note: See TracChangeset for help on using the changeset viewer.