121b
September 5, 2023, 2:52pm
1
What I’m trying to do
I am have created a template with following front matter. I expect that on inserting this template the fields created and aliases should get populated.
The created field gets populated correctly, however aliases is coming up as
aliases: []
front matter=>
created: {{date:YYYYMMDD}}{{time:HHmmss}}
aliases:
- {{date:YYYYMMDD}}{{time:HHmmss}}
- {{date:YYYYMMDD}}.{{time:HHmmss}}
Things I have tried
I created a nested metadata field, and it gets populated properly
id:
- timeID: {{date}}{{time}}
I copy pasted from created field, just to check if there were spelling errors
I tried both {{date}} and {{date:YYYYMMDD}} format
The date format is set to YYYYMMDD and time to HHmmss in Templates plugin properties.
I can’t figure out why aliases field isn’t getting populated properly.
Pch
September 5, 2023, 3:43pm
2
I have no idea why … but this seems to be working :
created: {{date:YYYYMMDD}}{{time:HHmmss}}
aliases:
- "{{date:YYYYMMDD}}{{time:HHmmss}}"
- "{{date:YYYYMMDD}}.{{time:HHmmss}}"
And if you already set up the default date format as YYYYMMDD
and the default time format as HHmmss
in the core Template plugin settings, I don’t even think you need to precise the format of the date & time here …
I mean, this :
created: {{date}}{{time}}
aliases:
- "{{date}}{{time}}"
- "{{date}}.{{time}}"
should give you the same result, I think
121b
September 5, 2023, 7:29pm
3
Thanks, it works now.
However if I were to use following:
aliases:
- "{{date}}{{time}}"
- "{{date}}.{{time}}"
- "{{date}} {{time}}"
I get
aliases:
- "20230905202633"
- "20230905.202633"
- 20230905 202633
why the first two end up in quotes and not the third one. Or if the third is the expected output from template then why first should have quotes.
Is there a bug here?
The first 2 end up in quotes to explicitly mark them as text strings instead of numbers. The third one doesn’t need that because it contains a space.
Pch
September 6, 2023, 8:38am
5
That makes sense !
Thank you !
system
Closed
September 13, 2023, 8:39am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.