I’m new to Obsidian. I also don’t have experience with coding languages other than R and markdown, but I’m fumbling around with Templater and Dataview trying to figure this out. I apologize preemptively for my ignorance.
What I’m trying to do
After creating a note from a template and filling out metadata, I’d like the note name and file name to automatically (or by hot key) change based on the data.
These notes are about journal articles, so at the top of the note template, I have:
**Title**: (ref.title :: title) **First Author**: (ref.author :: first author) **Co-authors**: (ref.coauthor :: notable co-authors) **Year**: (ref.year :: 0000) **Journal**: (ref.journal :: journal) **Type**: (ref.type :: type) **Created**: <% tp.file.creation_date(format = "YYYY-MM-DD HH:mm") %> **Last Modified**: <% tp.file.last_modified_date() %>
After I fill that stuff out, I’d like the file name to change to “First Author, Year, Journal”. This would save me from editing the title manually and maintain consistency with the titles.
Things I have tried
I’ve looked at [this] (Note title automatically generated from first words of the Note (similar to Joplin)) but it prompts the user for a title immediately upon opening it.
I’m not even sure:
- How to retrieve the value of a field given the key within a document. Let alone how to concatenate those to a string. If it were R, it would be
paste0(ref.author, ", ", ref.year, ", ", ref.journal)
- How to run the
tp.file.rename()command after the file has been created.
- Whether it’s even possible to mix Templater and Dataview language together like I’m imagining. Maybe there is a better way.