dbquizzical
dbquizzical

Reputation: 13

How to use setcontent to pull in taxonomy content

Having trouble getting setcontent to work as expected with Taxonomies.

I'm in a record template and want to pull in other items that share any of the same taxonomy values. So I don't want to hardcode the values in, but instead compare to my current record.

For example, here's a hardcoded query, checking for items that have 'Apps' in their topics taxonomy.

{% setcontent relinterviews = 'interviews' where { topics: 'Apps' } %}

Instead I need something like this pseudo code, but that works:

{% setcontent relinterviews = 'interviews' where { topics in record.taxonomy.topics } %}

Ideally, I want to be pulling in items that match two different taxonomies - Topics and Roles - but I'd settle for one.

Upvotes: 0

Views: 307

Answers (1)

Ross Riley
Ross Riley

Reputation: 826

Try these:

  1. To search for two of the same taxonomy.

{% setcontent relinterviews = 'interviews' where { topics: 'Apps || Other' } %}

  1. To search across two separate taxonomies.

{% setcontent relinterviews = 'interviews' where { topics: 'Apps', roles: 'MyRole' } %}

Upvotes: 1

Related Questions