1

I have an asset volume that has a category field. The category field has no max level so I can have parent/child categories. If I set a child category to the asset in /admin then all is well, but when I go to display the asset and category then I only get the top level (parent) category and not the child category set in /admin.

Similar thing happens if I use the group filter, the groups are only the top level category titles.

1
  • Please post the relevant part of your Twig template that's generating the incorrect output.
    – MoritzLost
    Mar 1, 2022 at 16:11

1 Answer 1

2

It seems that setting a child category also sets it's parents categories too (top level being first, and selected child category is last).

Able to get the category with {{ asset.categoryField.all()|last.title }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.