wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

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

Open amboutwe opened this issue 9 months ago • 6 comments

  • [x] I've read and understood the contribution guidelines.
  • [x] 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):
  • [x] 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

amboutwe avatar May 01 '24 00:05 amboutwe

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

amboutwe avatar Jun 11 '24 17:06 amboutwe

Slack: https://yoast.slack.com/archives/C01NCRHHN30/p1714551410785149

josevarghese avatar Jun 12 '24 05:06 josevarghese

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.

suascat avatar Jun 13 '24 20:06 suascat

+1 https://wordpress.org/support/topic/prev-next-links/

maybellyne avatar Jul 02 '24 16:07 maybellyne

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

josevarghese avatar Jul 08 '24 07:07 josevarghese

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

maybellyne avatar Oct 07 '24 16:10 maybellyne