How would you do Categories?

Hello,

I know this would be more as a personal preference but if it were your project. How would you do categories?

My specific case would be for a restaurant menu. Sample categories would be starters, vegetables, beverages, main dishes, etc.

Category field on each item/page? or subpages?

Just wondering on how you would approach this.
Thanks.

That depends. If the number of subpages is limited, then a category field will work fine.

Otherwise, and especially if you want the category structure reflected in the URL, category subpages might work better.

So, I would decide depending on the type of project and what I want to achieve.

3 Likes

I really prefer the separate pages that can be referenced via a multiselect approach. It allows you to add whatever properties you need to the category istelf since it’s now a page with as many fields as you want.

Blueprint: article.yml

category:
   type: multiselect
   options: query
   query: site.find("categories").children

Want your category to have an icon? A color? A description? All doable this way.
Want it to be restricted to one, instead of several? Change it to select. Done.

Hope this helps.

Ive built a lot of resturant sites and dont use subpages often. I put them all on one page and use structure fields. The only time i use seperate page is if they have an extensive drinks menu. Then i use one for food and one for drinks.

3 Likes