Can't list all products while creating an HTML sitemap, any advice?

I’m manually creating an html sitemap for better SEO. I was able to easily list my collection pages, but I’m unable to get a complete list of my products.

Here’s the code that I’m using:

Products

Would appreciate any help. Thanks!

There’s no easy way to do this due to the way Shopify paginates page requests to 50 products per page. You could have a multi-page sitemap powered by a collection page, but why not just leave it to the /collections/all page that already does this.

Otherwise you start getting into highly technical solutions like creating an app proxy that gives you a liquid object that can be output on a single page. Or creating some kind of meta-field that contains a list of title + URL per product and has some backend way of staying in sync with the actual list of store products.

Personally, I wouldn’t really bother with human sitemaps to individual products, maybe to collections, then link to /collections/all and say “here’s all our products”. There are usually much better ways to improve internal linking.