Using 'contains?' on bracketed vs non-bracketed property values

Contains uses a list.
So it is does this list contain this value.

When using double brackets you create a list of references in format #{"page name" "page name 2"}. For when you use for example type:: [[page name]] [[page name 2]]

This is then your input for contains.
So it is [(contains? #{"page name" "page name 2"} "page name")]
That will be a yes.
The equals sign is exact. Therefore, [(= #{"page name" "page name 2"} "page name")] will be a no.

In reverse your property value would not be a list. It would be a single value. This doesn’t work with contains, but does work with equals. Granted that both inputs are exactly the same.

Reasons to always use brackets:

  • makes a good linked reference. The link doesn’t also show up under unlinked references. (See: Linked reference considered unlinked at the same time?)
  • can always use multiple values in a property, without having to define it as comma separated page references in the config.
  • makes sure you use the correct page name as it will use the lookup function

I’ve opted to always just use double brackets. Also to just save myself the confusion.

1 Like