wordpress-seo
wordpress-seo copied to clipboard
Prev/Next links include the slug twice when using Query Loop block on non-homepage content
- [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:
- Create or import theme unit test content.
- Go to Admin > Pages > Add New Page
- Add Page title
- Add Query Loop block
- Click 'Start blank'
- Click 'Title & Date'
- Publish and view the page
- See the pagination links and they link to each page correctly
- Install and activate Yoast SEO (free)
- View the page again
- See the pagination links and they link to each page correctly
- View the source code
- See the next URL contains the slug twice
- 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
Page IS static front page
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
Please inform the customer of conversation # 1139910 when this conversation has been closed.
Slack: https://yoast.slack.com/archives/C01NCRHHN30/p1714551410785149
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.
+1 https://wordpress.org/support/topic/prev-next-links/
Please inform the customer of conversation # 1151893 when this conversation has been closed.
Please inform the customer of conversation # 1180959 when this conversation has been closed.