While inĀ­corĀ­poĀ­ratĀ­ing more of IndieWeb into my webĀ­site, I found myĀ­self imĀ­pleĀ­mentĀ­ing an idenĀ­tiĀ­cal logic in two temĀ­platĀ­ing lanĀ­guages: Liquid and Nunjucks.

To check whether a string exĀ­ists in an arĀ­ray, this is how you would do it in each lanĀ­guage.

In Liquid:

{% if data.publish-to contains 'mastodon' %}

In Nunjucks:

{% if 'mastodon' in data['publish-to'] %}

Accessing propĀ­erĀ­ties with speĀ­cial charĀ­acĀ­ters

In our exĀ­amĀ­ple, anĀ­other thing of note is how a propĀ­erty on the data obĀ­ject with a hyĀ­phen in its name ā€” publish-to ā€” is beĀ­ing reĀ­trieved.

Liquid comĀ­fortĀ­ably unĀ­derĀ­stands what is called the dot noĀ­taĀ­tion in JavaScript. This is quite imĀ­presĀ­sive.

Nunjucks needs what is called the bracket noĀ­taĀ­tion in JavaScript.