I can't figure out how (using the Meta Bind button) to add a template to an existing note

Hi!

  1. Here’s my question: How do I make a meta bind button that, when clicked, adds an existing template to my note?

  2. I see in the settings a choice such as: “Create note”, “Open”, or “templaterCreateNote”. But all this opens a note, or creates a new note,
    and I need to add an existing template to my note, not create a new one.

P.s. I tried to do this using a regular template. Without using Templater.

Is it possible to do this? If so, how?

I will be very glad to hear your reply!

If you make a template into a command from the templater plugin preferences “add hotkey” section (you don’t need to actually assign a hotkey) you can then use type:command to do it.

This makes a button that would insert the example template at the cursor:

label: ""
icon: ""
hidden: false
class: ""
tooltip: "example"
id: button-example
style: default
actions:
  - type: command
    command: templater-obsidian:template/example.md

Could you show me on a video or Gif how to do this?

Is there a way to do this using metalbind, without the templater plugin? If so, how?

so here’s where you’d add your template to turn it into a command that the above metabind code can see and use:

You can add as many as you like with the “add new hotkey for template” button next to it

and here you can see the command shows up as one of the commands you can select in the metabind button builder

and you get this code on the clipboard:

```meta-bind-button
label: This is a button
icon: ""
hidden: false
class: ""
tooltip: ""
id: ""
style: default
actions:
  - type: command
    command: templater-obsidian:example.md

```
1 Like

Yes, it worked, Thank you! The button adds the template to the note as I wanted.

But there was another problem:

  1. For some reason, when the button is pressed:

  2. The button shifts directly to the place where the template appears. But it should be static in one place, rather than shifting to another location.

P.s. This is what my template looks like.

Sometimes, when button pressed, everything works fine. Sometimes the button shifts.
What could be the problem?

I think I got it!

The template is added at the place where the user places the cursor in the note.
Therefore, if you put the cursor in the wrong place in the note, then button will shift.

It was necessary to place the cursor below the button. And then click on the button!

:grin:

1 Like