I want to make an alias using Templater’s dynamic commands (
<%+ ... %>) with multiple parameters, but it doesn’t work well, as I will describe below.
It works well when the command has only one argument. For example:
--- aliases: <%+ tp.date.now("YYYY-MM-DD") %> ---
(This example might look strange, but it is for an illustration purpose only)
Result (= what I see after switching to the reading mode):
However, it doesn’t work when it has multiple arguments. For example:
--- aliases: <%+ tp.date.now("YYYY-MM-DD", 1) %> ---
It looks like the parser recognizes the comma separating the arguments
1 as a delimiter separating two aliases. In other words, it appears to interpret the above YAML frontmatter as
--- aliases: - <%+ tp.date.now("YYYY-MM-DD" - 1) %> ---
I tried enclosing the whole command with quotes as below, but I’ve got the same result.
--- aliases: '<%+ tp.date.now("YYYY-MM-DD", 1) %>' ---
I also found that this problem doesn’t occur for non-reserved keys
(see here for the list of reserved keys).
--- key: <%+ tp.date.now("YYYY-MM-DD", 1) %> ---
So I suspect this problem is related to how Obsidian parses the alias metadata.
How can I fix this? Thank you.
- macOS Venture (version 13.2)
- Obsidian version 1.3.5
- Templater version 1.16.0