I’ve just added an improved version of a “Send to Obsidian” action. The improvements:
The note’s name is either the heading or the creation date-time, depending on the drafts beginning with a header or not.
A YAML header is added with the creation date and time of the draft.
The tags are written at the end of the note, under a separator line.
The vault name is an editable constant.
In practice :
If you start your draft with a #, it implies that the first line is a header — it doesn’t matter how many # there are.
In this case, the filename of the Obsidian note is derived from the header.
If the first caracter of the draft is NOT a #, the first line won’t be the note’s filename. Instead, the filename will be the creation date and time of the draft, in ISO format.
In any case :
A YAML metadata header is added at the top of the note, with an entry with the creation date and time of the draft.
The draft tags are added at the bottom of the note, below a separator line.
The meta data is generated from the draft. It has to go at the front of the Obsidian note, but it doesn’t have to go at the start of the draft; but the action looks like it probably modifies the draft too.
In Obsidian, it’s own default tagging approch is to include hashes terms in the body. These hyperlink to a tag search. Meta data for tags in the YAML do the same, but when you search you don’t see them in context in the results. I think that can add value, but adding them to the end vs adding them to YAML at the start I don’t think offers any difference, other than meta data can be hidden, and I don’t think would appear if published - but I don’t use the publishing service, so I don’t know for sure.
Yes, if the #tag#list is added to the end of the document the placement context is effectively lost. In that case it seems desirable to put those tags in the metadata where they can be hidden. This could also be used in some automated Obsidian to PDF action.
That’s correct: In the draft it has no value - as Drafts doesn’t do anything with it (including when rendering). Other Markdown processors, however, might well do.
Looks like it should just be vaultName. It is using thr Obsidian URL scheme, and so just needs the vault name registered in Obsidian to be able to match to.
Thankyou - yes I thought that and it just wouldn’t play nice. But with your thought I kept modifying and found the error … the credentials were hanging around from an earlier experiment - now working.
Thankyou for this - very nice. I haven’t playing around a bit and very much living what I find. Sometime tho I have noticed that the action ‘stops working’ …
I repost the same draft just to experiment ,
In drafts it is as if once a draft is posted - it won’t post again?
But if I reset the draft it is all ok again.
Is that correct behaviour? I can understand why - just wondering
If you post with a level 1 heading draft as the title it will recreate the same file. If no such heading is present it will post with a timestamp as the file name. The timestamp is down to the second, so for a single draft I think you would alway get a unique file name and thus a new file.
Does that explain the behaviour you see? If not, can you provide more detail on the behaviour you see?
i have pushed and prompted and persevered - and getting there. it still seems that SOMETIMES - if there i no header - the draft doesn’t post to obsidian - but not always - sometimes as you say - a tie stamp is there … i cat get anything repeatable right now though.
This thread seems to be most relevant and I’m looking for any advice. I want to include a TAG with an ACTION that sends DRAFTs note to Obsidian. I want that TAG to populate the “front matter” and appear at the top of my Obsidian Note (where properties are displayed if you toggle them on) but can’t figure out what I’m doing wrong. I’ve tried entering my tag with and without a hash tag. The creation date sort of works (had to click it to display correctly), but the TAG doesn’t at all. Would appreciate any recommendations.
Attached is a snapshot of of the ACTION (pulled from ACTION DIRECTORY) and then modified. There is a snapshot with and without hashtags. Also attached is the resulting Obsidian note. Notice the TAG property is empty.
I think with the Tags field in the File action step you’re creating a tag on the file (in finder / apple files app). The [[tags]] you use in the template only processes tags from the actual draft.
I assume your draft does not have any tags and that’s why the Obsidian note doesn’t get populated with tags.
Dang it! @FlohGro, you’re right! It’s tagging the file in the FINDER! I’m coming from DRAFTS ACTION that added a default tag named “call log”when it created an Evernote note.
Sounds like you’re saying I’ll have to insert the TAG “#call-log” in my formatted note to have it picked up. An extra step and I will have to get use to seeing the HASTAGS in the drafts note now. I’ll start testing to see if this approach places the TAG in the property section. Thanks for hunting down this tag.
When I try entering the tag in the TEMPLATE, it still doesn’t transfer. Maybe I missed your point:
tags: #Call-Log
date: [[created|%Y-%m-%d]]
Or
tags: Call-Log
date: [[created|%Y-%m-%d]]
Both end up with the date working but not the TAG. If you meant ADD the TAG in the physical draft each time or CLICK on my DRAFTs note TAGs, and add back [[tags]] in the template…that works. However, I was trying to avoid the extra step.
Placing it in the body of the note will transfer, and appears to create the TAG, but the tag won’t populate the PROPERTY section (front matter).