Clarification on how Products get sorted within Collection Template Based on the sort_by attribute

Shopify Partner
3 0 1

I am trying to create a custom Collection template that I can use for the sake of creating a custom product Collection filter which the customer can use to Sort products. I've got enough of understanding that the collection templates are used as API Endpoints in order to get the sorted products which I need to be able to then insert into my own custom landing page. The part that I'm not understanding is how the products actually end up getting sorted within the template - based on being passed the "sort_by=title-descending" attribute in the URL or being passed that same data via Liquid. Is there a Liquid expert that I can speak to for answers here?

Here is the collection I'm working with - but the Sort filters are not actually working.

Ive basically taken the same collection template for other collections where it is working - but instead of rending the "product-loop.liquid" snippet, I'm rendering my own product loop and wondering what I need to add to my own product loop/product thumbnail code to make the sorting actually work.