I’m building some templates for work, and I’m trying to use the [[date]] tag and formatting options, but for some reason its not accepting the formatting options I give it. What am I doing wrong here?
You can also create a more complicated action which references this template draft to then create a new one every day (since this is for a daily note). If you need help putting that together, let me know.
Thanks for the help, that’s essentially what this template is used for, as I’m using it with the “New Draft from template” action (TIP: Creating New Drafts with Templates)
The tag [[date]] resolves fine in the preview window, but when I try to format it won’t recognize it.
One question, is the format on the top the same for all your files or it changes depending on the draft?
@motopascyyy Sorry for the previous question I missonderstood your question.
Your problem is that you are not using the format correctly. Here’s an example
You are writing something like then, and when you create a new file from the template you get the same as text
[[date|%B %d %Y]]
But that’s because the format expects dashes instead of spaces like below
At least from everything I just tested it worked fine for me with the correct formatting, expect in the preview window, there it stays as text. But if that’s also part of the problem, let me know to think of a solution
That’s odd. I was able to use the action listed in the guide and used your template exactly as is, and it worked.
Here’s what I did:
Create a draft with the appropriate template and tagged with
Run the selected action:
Select the appropriate template:
The expected Draft is then created with the dates as expected:
@Wrxhokie, does this look like the same steps you’ve taken?
That’s good to know, because I was going by the preview view only to make sure it was correct first. I guess the preview window doesn’t interpret date formatting correctly.
@agiletortoise will probably need to confirm, but the preview action on its own won’t “process” the templates. Processing the templates means scanning for any of the appropriate syntaxes (like [[date]]) and then converting them in the text (either in memory or in the actual draft).
This makes sense to me because you can’t always guarantee that text matching a typical template isn’t meant to actually just be the text. The preview action is basically a way of throwing the current draft into a Markdown (or other) parser and then converting that into HTML so that it looks pretty. It’s not a preview of what the template would look like now if you were to trigger an action. I hope this helps explain it a bit.
Template tags only get processed only when pushed through Drafts’ templating engine. That happens when using actions that are configured to utilise it. Either through particular steps that support tag processing, or through an explicit set of code in a script step.
The templating engine is not a standard preprocessor to the default Markdown to HTML preview functionality or actions, but you can create actions to do this preprocessing.
As they said, it doesnt work with live preview, if you want to preview them you need a custom preview from an action
Thanks guys, makes sense now.