I'm new to Craft and I'm trying to create very basic product listing pages based on Categories and I'm not sure where to start.
First, it doesn't look to me like you can create separate templates for each category, only the Category group, correct?
If that's true, then I need that template to be dynamic and list the products in a category that may be nested. The idea being that I will have navigation that will resolve to each category page.
I've gone through the page on Querying Categories and I think querying by Slug is what I want. I altered the code on that page based on this post in order to get whatever the last segment is:
{# Get the requested category slug from the URL #}
{% set requestedSlug = craft.app.request.segments|last %}
{# Fetch the category with that slug #}
{% set category = craft.categories()
.slug(requestedSlug|literal)
.one() %}
{% set entry = category %}
{% for entry in entries %}
{{entry.title}}
{{entry.url}}
{{entry.image}}
{% endfor %}
For clarity I didn't put the entry items in HTML.
I feel like my problem is the second bit, setting the entry to category (which I cobbled together from posts here and in the docs) but I can't figure out how to get at the entry details from items in a category.
I also need to paginate the listings if that makes a difference.
Thanks in advance for any advice or pointers to good tutorials on using Categories to generate product listings.