Templater 1.6+: Combining dynamic commands and Javascript commands (undocumented)
Say you have a front matter field deceased: but only want to calculate/show the date if it’s defined (or non-empty), and a simple - if not.
You can actually combine Templater’s <%+ (dynamic) and <%* (Javascript) “introducers” as follows:
Use <%+*—this should produce dynamic results (if I’m not being caught by caching again):
<%+* if (tp.frontmatter["deceased"]) {tR+=moment(tp.frontmatter.deceased).format("ddd, YYYY-MM-DD")} else {tR+="-"}; %>
Now isn’t Templater great?