Typically, I will create a single for each product "home" page, and then a channel for my products or sub-pages. I will generally use a channel vs. a structure unless I know I want to manually control the order or nest entries.
Let's say I have a website about automobiles. I would create a section (single) called cars
. That section would have the url of site.com/cars
and the template would be located at /templates/cars/index.html
. This is the template that would be responsible for pulling in all of the cars I have.
This is where things can get tricky, or not...all depends on how you want to roll.
If you created a channel called automobiles
(or whatever you like), you could enter each car you have as an entry within the channel. Then on your cars
single, you can tell Craft to loop through all entries in the automobiles
channel.
Since you can't nest a channel entry, I would use categories to "tag" your cars. For example, I would create a category called Sports Cars
and relate any sports cars I have to that category. You could also create a category for Trucks
or Vans
to help group/classify each car you had.
This would also allow you to create sudo-landing pages for each type of car. For example, site.com/cars/sports-cars
would get all entries that are tagged as a sports car. You could do this for trucks, or you could even divide categories up into trucks/4-wheel-drive
so not only would a truck show when I requested trucks, it would also show in my 4-wheel-drive options.
From an authoring experience, this is great. I don't care specifically where I have to create the entry - all I know is that I have a car, and it goes in the cars "bucket" (automobiles channel). It's within that entry (the car entry itself) you are choosing where it is available to the end user.
You could even create different entry types for the kind of automobile you are creating. This would allow you to have a cleaner screen as some fields don't apply for all automobiles.
To illustrate a structure, think about the staff who is in charge of this car-selling company.
I would create a structure called staff
. It would have the url of site.com/about/staff
and a template of /templates/about/staff/_entry
From there you could create an entry for each person. You can then create "parent" entries for the hierarchy of the office.
For example:
- Management
|-- Bob McKenzie
|-- Doug McKenzie
- Sales Team
|-- Tyler Durden
|-- Agent Smith
By using a structure here, you can not only manually set the order of which group (management or sales) is first, but you can also arrange the order of the team members within.
So to answer your question directly:
I would like to display a parent page which lists all products, but then 6 sub-pages which show only the products in that category. I use the word category without specifically meaning the Craft CMS category
I would do this:
Create a single and give it a name of the url that you would like to show all products on. To use my example, this would be cars
.
Create a Category to relate your products to Ex: Sports Cars
.
Then create a channel - called Products
. Every product will go here. When you are creating these product entries, use a Channel Field type so you can select which category the given product belongs to (Sports Cars).
Then on your cars
page, you would tell Craft "Hey, get every single product".
If I navigate to site.com/cars/sports-cars
you can tell Craft "Hey, only get me cars that are related to sports cars".
Kind of a long-winded answer, hope it helps get you going.