Hello,
I have a classification field in my set of md files which contains a sentence (many words) and then there are some md files where there is no classification (hence there is no content for classification on these).
Structure of MD files in content/fruits folder
fruit_code: "A001"
usage_name: "Apple"
scientific_name: "Malus pumila, Malus domestica, Malus sylvestris, Malus communis, Pyrus malus"
taste: ["sweet", "sour", "savoury"]
color: ["red", "green"]
pics: "fruits"
classification: "seeded, citrus"
When generating content, I would like to do the following -
- Find if the classification param is non empty
- When non-empty, I would like to search for a string like “citrus” or “berries” in the classification param and then
- Present the info in a grouped way such as -
citrus:
List of names of fruits that have citrus in their classification
berries:
List of names of fruits that have berries in their classification.
The above list needs to be alphabetically sorted, so I am using the sort as well.
I understand that this might not the best way to represent because there can be instances where a fruit might have more than one classification and my approach might not place the fruit name in other categories, but for now, I think I am okay with that (reason being I need a pointer on how to write my where statement and get things going).
This is what I have been trying (knowing that what I am writing is wrong - citrus would eventually need to be replaced with something more dynamic so that I can process more classifications like maybe use this inside a range or anything, just placing it here so that the community knows that I am trying, just not getting the right direction)
( sort ( in (where $.Site.Pages "Section" "fruits") "Params.classification" "citrus") ".Params.fruit_code" )
Any suggestions would be welcome.
Thank you again for being my guides.
Sid.