Using
- Calendar
- Periodic Notes
- Templater
I managed to create this marvelous template below, for my daily notes. It’s activated, when I click on any day of the Calendar pane on the right. And the corresponding note is created, absolutely perfect.
BUT: Switching from Reading to Edit Mode, Obsidian shows the harsh truth, in pastell red:
Invalid YAML.
On Windows, everything works fine, nevertheless.
On Android, nothing works but the error message, template could not been processed, or something like that.
What I’m trying to do
---
<%*
// moment.locale('de');
let m = moment(tp.file.title);
let dayNow = m.format("dddd, D. MMMM YYYY");
let dayWeek = m.format("dddd");
let dayPrev = m.subtract(1, 'd').format('YYYY MM DD');
let dayNext = m.add(1, 'd').format('YYYY MM DD');
let week = m.format('gggg [W]WW');
let month = m.format('YYYY MM');
let quarter = m.format('YYYY [Q]Q');
let year = m.format('YYYY');
-%>
Datum: <% dayNow %>
Wochentag: <% dayWeek %>
Woche: <% week %>
Monat: <% month %>
Quartal: <% quarter %>
Jahr: <% year %>
---
# <% tp.file.title %>
Datum: <% dayNow %>
Wochentag: <% dayWeek %>
Woche: <% week %>
Monat: <% month %>
Quartal: <% quarter %>
Jahr: <% year %>
The TP embedded JS part alone is valid. As soon as I add any Key, Value pair, I’m lost.
Of course, I’d like to understand, what’s going wrong here, on the YAML, Templater, JS side.
AND I’d like to learn, why it makes a difference, running my vault on Windows vs. Android.
Any hint is welcome.
Thank you ever so much in advance!