question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Template variables not processed?

See original GitHub issue

Maybe I m doing something wrong here (new to the plugin). I created a “Template” Quick add and selected the template from the list (using the Obsidian core plugin, NOT templater). However, template variables like {{title}} are not being processed. When I run the Obisidian command to add the template to the current note, it works fine

To Reproduce Steps to reproduce the behavior:

  1. Create a template (with core plugin) using variable {{title}} somewhere in the template
  2. Create Quick Add Choice of type “Template”
  3. Select the template created in 1.
  4. Run the Quick Add command

Expected behavior New note gets created using the specified template. {{title}} variable gets replaced with actual value.

Actual behavior New note gets created, however {{title}} does not get replaced.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:9
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
chhoumanncommented, Nov 23, 2022

Hi everyone, thank you for contributing to the discussion here!

This isn’t a bug. It is intended. I can see, however, that this is something which could contribute to the experience of using QA.

There are two reasons why I haven’t implemented this already:

  1. Obsidian is closed-source, so it isn’t as simple as just invoking the core plugin (as it is with Templater) and having it do it.
  2. The title is an issue. The reason it works with <% tp.file.title %> (Templater) is because that is done after creating the note. QuickAdd tries to do things before actually creating the note.

As a compromise, I have allowed all format syntax to be lowercase as of #326, or v0.7.0. Meaning, {{DATE}} is now equivalent to {{date}}.

That leaves {{time}} and {{title}}. As @Amparose mentions, you can use {{DATE:YYYY/MM/DD}} and {{DATE:HH:mm}} (or lowercase now) for {{date}} and {{time}}, respectively. This was the indented use from the start.

I may implement {{title}} at some later date. Please track #327 for this.

Again, thank you everyone for contributing! It is very much appreciated.

1reaction
stephenalandaviscommented, Sep 12, 2022

Just wanted to add that this also doesn’t work with the other template variables: {{date}} {{time}}.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug] Template Variables Not Working if Field Type is a ...
The template doesn't work when the field of a variable is a number. When writing a query in a template, I use a...
Read more >
Typing $ to create or list template variables does not work - Jira
Edit or Create a template using the new editor;; Insert a variable into the template by: Clicking the + button on the top...
Read more >
variables no longer working in provisioning {a bug?}
I've been successfully provisioning machines for quite a few years using VARIABLES within my provisioning templates. I've just moved from LDMS 9.0 to...
Read more >
82292 – Code template variables not working - Bugs - Eclipse
From CDT 2.1 1. In a project, create a new file ("test.c"). 2. Type "com" then Ctrl-Space, to invoke the comment block for...
Read more >
YAML pipeline - Variables in template aren't passed down to ...
Hi there, This is an expected behavior. The template in steps will not be processed at compile time. In a pipeline, template expression ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found