Cms: Modifier option_list can't be used with taxonomies (as in v2)

Created on 17 Sep 2020  路  7Comments  路  Source: statamic/cms

Bug Description

In v2, you could use the modifier option_list with taxonomies in a post. This was really useful, because with this simple logic you could display related posts, based on the post taxonomies.

This worked perfectly fine in v2:

{{ collection:products url:isnt="{ url }" taxonomy:brand="{ brand|option_list }" taxonomy:category="{ category|option_list }" limit="2" }}
<a href="{{ url }}">{{ title }}</a>
{{ /collection:products }}

How to Reproduce

  1. Create some taxonomies ("brand" and "category")
  2. Create some posts and connect them to one or more of the brand and category tags.
  3. Use the above code in your post.html

Environment


Statamic 3.0.9 Pro
Laravel 7.26.1
PHP 7.4.6
statamic/migrator dev-master
statamic/ssg 0.2.0

Install method (choose one):

  • Fresh install from statamic/statamic
needs more info

Most helpful comment

You definitely prefixed it with a colon?

All 7 comments

Try :taxonomy:brand="brand"

That does seem to work! Closing this one, feel free to reopen if that was too premature.

:taxonomy:brand="brand" didn't work, I'm afraid

Reopen this issue, please?

You definitely prefixed it with a colon?

I definitely didn't... My bad! Works like a charm! Thanks

Thanks, this helped me out while migrating a Statamic 1 "related articles" section to Statamic 3.

I wasn't sure what the :taxonomy:tags="tags" syntax was called, but I dug around and found it: dynamic binding.

https://statamic.dev/antlers#variables-inside-tag-parameters

Was this page helpful?
0 / 5 - 0 ratings