And if you’re including a number of tags (thus, a number of filter runs), you may prefer the slightly shorter equivalent
<% if [{!!title}tag[Plant]] [{!!title}tag[herbs]] [{!!title}tag[vegetables]] %>
Alternately, if all your tags are single words (no white-space!) you can do this with a search
instead:
<% if [{!!title}search:tags:some[Plant herbs vegetables]] %>
- By default, the
search
operator will treat its parameter Plant herbs vegetables
as three separate strings (separated by whitespace) which must all be found in the tags
field. If all three of these words are found somewhere in the tags, the filter will return the title of the current tiddler.
- By adding the flag
:some
, we can change search
's behavior so it will return the title of the current tiddler if any of the listed words are found in the tags.
-
search
is case-insensitive by default, but you can specify search:tags:some,casesensitive
if you don’t want to consider “Herbs” a match for “herbs”.
- Note that
search
does not care about word boundaries, just about strings of characters — so [{!!title}search:tags:some[Plant herbs vegetables]]
will match if the current tiddler has the tag “plantation” but none of the tags “Plant”, “herbs”, or “vegetables”. If this kind of “fuzzy” match doesn’t work for your use-case, search
won’t work for you here.