问题
I think this is because I don't know how replacement tokens work. Another example problem is up one level on the edit Layout, I want to set the item class to work-item {Category}, Category being the name/title of a property, which I am using for grouping.
Right above the projection: I want to include some html that lists all the Categorys in a ul i.e. data-filter=".experiential" I have tried things like: work-item {Category} and work-item {Content.Fields.CaseStudy.Category}. Category is a "term" (?) from a taxonomy.
回答1:
Try this:
{Content.Fields.CaseStudy.Category.Terms:0}
A taxonomy field has a collection of terms, so you need to first access the Terms
property of the field, then specify which one you want (the first one in the example above), if the field is configured to allow for multiple values. If it's configured for a single value, you may get away with removing the :0
at the end as this will concatenate the values into a comma-separated list, but since you have only one, that will be equivalent.
来源:https://stackoverflow.com/questions/40250304/orchard-cms-query-raw-layout-level-access-to-properties