mo-seph / obsidian-note-from-template

Simple plugin to create Notes from a template, and fill in fields defined there
MIT License
107 stars 9 forks source link

YAML fields in templates might be getting lost #21

Open mo-seph opened 2 years ago

mo-seph commented 2 years ago

If the template has some YAML fields that are not used by note-from-template, it could be that they are being removed from the final output

AJP4 commented 2 years ago

TEMPLATE for a Book Review

---
Status: Done
tags: source/book, {{tags}}
aliases: "{{aliases}}"
fileClass: Book
cssClass:

template-input: title
template-output: RESOURCES/SOURCES/BOOKS
template-should-create: "open-pane"
template-name: "Book"
template-should-replace: "sometimes"

---

Book Title:  **{{title}}**

## Notes

{{initial-notes}}

## Meta Data
Author:: {{Author}}
Genre:: {{Genre}}
Date-Read:: {{Date-Read}}
Rating:: {{Star-Rating}}

Links:: 

CREATES THIS FILE IF NONE OF THE FIELDS ARE POPULATED; BY WAY OF EXAMPLE

---
Status: Done
tags: source/book, 
aliases: 
fileClass: Book
---

Book Title:  **MyBook**

## Notes

## Meta Data
Author:: 
Genre:: 
Date-Read:: 
Rating:: 

Links:: 

NOTICE THAT cssClass is missing in the YAML

mo-seph commented 2 years ago

That's very helpful, thanks! I'd guess that my YAML library is discarding empty tags, so that's a good place to start. If it is, then I'm not sure how much I can do about.