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

Fix Paginated URL if there are query params

Open andreas-pa opened this issue 2 years ago • 1 comments

Context

  • Fix the pagination url to show the query params at the end and not in the middle.

Summary

This PR can be summarized in the following changelog entry:

  • Fixed paginated canonical URL when we are having query params in the url.

Relevant technical choices:

Test instructions

  1. Set up WooCommerce
  2. Install Yoast SEO
  3. Create 3 products and translate
  4. Go to Appearance > Customize > WooCommerce > Product catalog > Set "Products per row:2" and "Rows per page:1"
  5. Add this snippet in functions.php of the current theme
add_filter( 'page_link', function( $url ) {
    return add_query_arg( 'foo', 'bar', $url );
} );
  1. Check page source and the canonical entry
  2. The canonical link should shows something like this /page/page/2/?foo=bar

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • The test steps for the acceptance can be the same as test instructions

Test instructions for QA when the code is in the RC

  • [X] QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • [ ] This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • [ ] This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • [ ] I have written documentation for this change.

Quality assurance

  • [x] I have tested this code to the best of my abilities
  • [ ] I have added unittests to verify the code works as intended
  • [ ] If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • [ ] I have written this PR in accordance with my team's definition of done.

Fixes https://github.com/Yoast/wordpress-seo/issues/18275

andreas-pa avatar Mar 28 '22 16:03 andreas-pa

Also experiencing this issue. Any update on when this will fix will be merged?

romerocs avatar Sep 21 '22 19:09 romerocs

Any chance that this gets merged?

cmuench avatar Jan 13 '23 11:01 cmuench

Hi, I have exactly the same problem. Is there a chance that it will be fixed in the near future?

Ryshev avatar Jan 14 '23 16:01 Ryshev

@andreas-pa thank you for this solution!

We've used the bulk of it and created a (draft, for now) PR for this, where we intend to give you props 😃

It's going to go through our normal processes after we finalize it with Test Instructions and Impact check, but your own PR gave us a great starting point, so thank you for that 🎉

leonidasmi avatar Feb 17 '23 10:02 leonidasmi

Is there any progress on this issue?

Ryshev avatar Mar 31 '23 09:03 Ryshev

This has been merged separately here and rolled out with the Yoast SEO 20.3 release @Ryshev :)

I'm gonna close this PR now to avoid any further confusion.

leonidasmi avatar Mar 31 '23 09:03 leonidasmi