Yoast / wordpress-seo

Yoast SEO for WordPress

Home Page:https://yoast.com/wordpress/plugins/seo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prev/Next links include the slug twice when using Query Loop block on non-homepage content

amboutwe opened this issue · comments

commented
  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened

When a non-homepage contains a Query Loop block, the prev and next URLs include the slug twice. A previous fix for a similar issue. Pages can also be nested so that should be taken that into account as well.

Workaround

No known workaround.

To Reproduce

Step-by-step reproduction instructions

Starting with a vanilla installation:

  1. Create or import theme unit test content.
  2. Go to Admin > Pages > Add New Page
  3. Add Page title
  4. Add Query Loop block
  5. Click 'Start blank'
  6. Click 'Title & Date'
  7. Publish and view the page
  8. See the pagination links and they link to each page correctly
  9. Install and activate Yoast SEO (free)
  10. View the page again
  11. See the pagination links and they link to each page correctly
  12. View the source code
  13. See the next URL contains the slug twice
  14. Check page 2's source code and see the slug twice for prev and next

Expected results

https://example.com/query-loop-block-test/?query-0-page=2

Actual results

https://example.com/query-loop-block-test/query-loop-block-test/?query-0-page=2

Screenshots, screen recording, code snippet

Page is NOT static front page
screenshot_190

Page IS static front page
screenshot_192

Technical info

  • If relevant, which editor is affected (or editors):
  • Block Editor

Used versions

  • Device you are using: Desktop
  • Operating system: Win 11
  • PHP version: 8.0.30 (Supports 64bit values)
  • WordPress version: 6.5.2
  • WordPress Theme: Twenty Twenty-Three (twentytwentythree)
  • Yoast SEO version: 22.6 (also tested 22.1 and 22.7 RC 1 but issue happens in those too)
  • Relevant plugins in case of a bug: N/A
commented

Please inform the customer of conversation # 1139910 when this conversation has been closed.

The customer in conversation #1139910 has also mentioned that the canonical output on the paginated pages that are not the homepage displays inaccurate information.

For example, the canonical on the /page2/ should self canonicalize.

<link rel="canonical" href="https://example.com/query-loop-block-test/?query-0-page=2"/> [Expected]

However, it points to the main page

<link rel="canonical" href="https://example.com/query-loop-block-test/" /> [Actual result]

You can reference to the screenshots in above bug report details as well.

Please inform the customer of conversation # 1151893 when this conversation has been closed.