Dynamic property templates

Dynamic property templates

I used to use templates to keep my YAML frontmatter consistent, which has been solved now thanks to Properties. I think the next greatest related feature, for me at least, would be to dynamically change properties in multiple notes.

Example: all recipes are using the same set of properties. After months and many recipes added, I decide that I want to add a new “calories-per-serving” property to all of them. As far as I know, there’s no easy way to do this.

Proposed solution: property templates

Not sure if this should be a core feature or if this has a better place as a plugin idea, but I kind of got excited with Properties so I’m leaving it here as a potential next step.

One solution I can think of is “property templates”.

  1. New property templates folder: users can create a “property templates” folder.
  2. Add 1 property template per note: when creating a new note, the user can pick a property template from the folder. Maybe limiting this to one such template per note .
  3. Dynamic update: if the user wants to make changes to all notes using the template, they should go to the folder and modify the original template.
  4. User confirmation: if Obisidian detects the template is in use, it should inform about how many notes will be affected so the user has to confirm before applying the changes.
  5. Changes to individual notes using property templates: the user can modify individual note properties even if they’re using a property template, but when batch changes happen they will still be affected, like so:
    5.a. If a property was deleted, it will reappear.
    5.b. If a property type had been changed, it will change again to the type set by the template.
    5.c. If a property does not appear in the template, it will be ignored and remain in that individual note.

Proposed solution 2: batch modify properties

Another solution would be to be able to:

  1. Filter notes: for example, find all notes with the hashtag #recipe
  2. Modify properties of all those notes:
    2.a. + Add new property type and name of property to all notes
    2.b. Remove property select existing property from all notes in the selection that have it

I am not aware of any workarounds for this. I guess option 2 sounds easier but I don’t have a favourite. What do you think? Would you have a use for this?

3 Likes

I would also love this.

1 Like

I read a complex discussion (New Properties and templater prompts and commands? - #65 by Feralflora) of updating templates using Java script. It is way beyond me, but it made me think that I do not have the skill set necessary to use templater. My goal is only to keep my properties consistent. I do not need to do much else. Maybe I should not be using metadata and templater. Any change in properties will not be updated for the near future. I am re-doing my vault trying to utilize data view, but do I really need java script to keep my properties consistent?

1 Like