How to adjust the canonical on paginated pages?

Here’s how to JavaScript it in… not sure if it’s effective yet. Taken from a Webflow wishlist page.

SEO friendly pagination (correct canonical URL)

The confusing/curious thing, is that ALL of my various collection item pages are in the sitemaps.xml file. However, the pagination pages are not.

And at least in an ahrefs.com crawl, it sees these pages as orphans that aren’t linked to anywhere. Because the pagination pages refer to a different canonical URL and aren’t index. Google seems to be a little smarter about it.

But I’m having different issues on Google. More of it just refusing to index pages that it has discovered. So I’m manually requesting indexing of at least category pages to help hopefully with it refusing to index discovered/crawled pages.

I’m wondering if each pagination page should also be added to the sitemaps.xml page. That would be a nice feature. Can’t see why it would hurt.