Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
from777 opened this issue May 14, 2024 · 3 comments

Comments

@from777
Copy link

from777 commented May 14, 2024

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 ?

@from777 from777 changed the title [question] Is it possible to run a template and create a new note via a link? [Question] Is it possible to run a template and create a new note via a link? May 14, 2024
@pkej
Copy link

pkej commented Jul 14, 2024

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
Copy link

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
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants