Hello, it’s been several days that I have been puzzling to find a solution to my problem …
I am building a new blog that contains categories and subcategories.
I have a main “blog” page which contains all the articles.
Something like:
- /Blog
-
- article01
-
- article02
-
- article03
Each article is defined with a main category:
- /Blog
-
- article01 - category: tests
-
- article02 - category: tutorial
-
- article03 - category: tutorial
An article can also have a sub-category:
- /Blog
-
- article01 - category: tests
-
- article02 - category: tutorial
-
- article03 - category: tutorial / beginner (or advanced / expert / etc…)
However I need to be able to create and edit the categories in the panel: blog.yml
, so with the structure fields it’s good:
category:
type: structure
fields:
name:
label: Category name
type: text
subcategory:
label: Sub-Category
type: structure
fields:
name:
label: Sub-Category Name
type: text
So I still have to find a way to be able to select a subcategory in the same way as this: Conditional fields.
I imagine it like this:
When editing the article I select my category with a “select” field.
If I select the “tutorial” category, a second “selec” field appears so that I can select the subcategory.
Here I tried to be as clear as possible for the explanation, I had stopped coding for a long time and I am completely lost today and I see that Kirby has evolved a lot.