This is a stripped-down version of a single section of Grok TiddlyWiki, optimized for fast loading and readability by search engines. Some features are missing.

For the full Grok TiddlyWiki experience, please visit the wiki version of this page.

Ex:VeryOrdinaryDay/answer

 30th September 2024 at 9:10pm

The most obvious approach is to use a conditional expression. In this example, we set the variable holiday so we don't have to write the same filter twice, but you could also use a function, or simply run it twice (it won't be much slower, just uglier):

<$let
  formattedToday=<<now "0MM/0DD">>
  holiday={{{ [[UsHolidays]getindex<formattedToday>] }}}
>

<% if [<holiday>!is[blank]] %>

  It's ''<<holiday>>'' today!

<% else %>

  Sadly, it's a very ordinary day today.

<% endif %>

</$let>

Sadly, it's a very ordinary day today.

However, a more concise approach is to use the $list widget with the emptyMessage parameter, which is rendered if the filter returns no results:

<$list filter="""[[UsHolidays]getindex<now "0MM/0DD">]""" emptyMessage="Sadly, it's a very ordinary day today.">
  It's ''<<currentTiddler>>'' today!
</$list>

Sadly, it's a very ordinary day today.

Go to question: Ex:VeryOrdinaryDay