Vinzent03 / obsidian-advanced-uri

Advanced modes for Obsidian URI
MIT License
730 stars 43 forks source link

[Question] Is it possible to run a template and create a new note via a link? #172

Open from777 opened 4 months ago

from777 commented 4 months ago

I have a template with code from templater plugin, is it possible to run this template via advanced uri to create a new note ? And I also need to change the Frontmatter field, it is clear how to do it, but it is not clear whether it can be combined in one link, so that first created a note on the template, and then changed the Frontmatter field to a given value and all this in one link ?

pkej commented 2 months ago

I didn't read what you asked properly. this is not as solution, and I confused this plugin with "actions-uri". In actions-uri there are specific commands for triggering templates, and for setting and getting properties.

A quick look and test with the plugin shows you can do it by just raw-writing to the file:

obsidian://advanced-uri?vault=Zotero&filepath=my-file&data=---%0Aproperty:%2520value%0A---%0AThis%2520text%2520is%2520overwritten&mode=overwrite

Result:


---
property: value
---
This text is overwritten
```</strike>
constpetrov commented 2 months ago

I've tried doing the same using Raycast. It creates a link like that obsidian://advanced-uri?vault=&daily=true&data=Hello%2520World&mode=append (with your vault name). The file is created, however the templater doesn't run on file creation, and some parts aren't processed because of that.

oschrenk commented 2 weeks ago

I'm trying to create a file based on a template same as OP

I'm following the advice at https://vinzent03.github.io/obsidian-advanced-uri/tips#insert-templates-templater-supported

and do this:

[link](obsidian://advanced-uri?vault=cafebabe12345678&commandid=obsidian-hotkeys-for-templates:30%20Areas%2FAcme%2FMeetings%2F2024-08-30-meeting.md)

Nothing happens though.

In the console I see:


Received URL action 
{
    "action": "advanced-uri",
    "vault": "cafebabe12345678",
    "filepath": "30 Areas/Acme/Meetings/2024-08-30-meeting.md",
    "commandid": "obsidian-hotkeys-for-templates:30 Areas/Acme/Meetings/2024-08-30-meeting.md"
}

But nothing happens. In the "Hotkeys for templates:"

  • I enabled the template type
  • I also saved a mapping under "Create a new file in a specified folder with a specified template" using the folder mentioned below and mapping it to the activated template.

The documentation at https://vinzent03.github.io/obsidian-advanced-uri/tips#insert-templates-templater-supported seems to support my approach but it lacks an example and is not clear on explaining if the filepath needs be a full file path or just to the directory, or if the path needs to match any of the saved mappings (i just assume so).

What am I doing wrong?