V1.4.5 Templates automatically merge properties with existing properties in the note does not work

Hello Obsidian community :slight_smile:

I’m new to this - but i’ll have a try…

What I’m trying to do

When a template is loaded into a note, the aliases of the template should be merged alongside the aliases of the note.
But after trying this, the whole note inclusive metadata (front matters?) are only copied into the note at the current curser position, and aliases are not merged:
grafik

I read in v1.4.5 changelog that this should be possible:
“Templates automatically merge properties with existing properties in the note”

Things I have tried

I use Obsidian only for two months 'till now and have no idea where to start solving this problem.
Does anyone have the same problem like me and/or a solution for me?

Cheers

Take notice that the YAML format is picky regarding white spaces.

Is the value test2 correctly indented with two spaces? I.e.,

aliases:
  - test2

works for me.

Thanks for helping me.
Yes - in YAML format there are two spaces befor the hyphen.
The Properties in documents are set to “Visible” and for creating the test note and test template I used this new format of 1.4.5 for the metadata → So two spaces are the default setting for multiple aliases.

Please copy your template, if it does not have sensitive information, here into Discord.

I think the problem might be with your template.

This is an example of what a valid frontmatter looks like. This is something like what your template should be generating, with regard to:

  • Three dashes on top and bottom (nothing above three dashes and an empty line after the bottom ones.
    Don’t make multiple three-dashed sections one below the other.
  • As @stef.rausch also pointed out, you need two spaces and a dash, then a space with your values (such as mine in the example).

Thank you gino-m.
I’m familiar to YAML-syntax and i’m fine with it by scripting them manually.
My intend is to merge aliases automatically with templates into existing notes. In Version 1.4.5 this should happen automatically. But when i load the temlates into the notes, the aliases are not merged and there are only another three-dashed YAML-sections added to the note.

TestNote

aliases:

  • test

Test Text

----------------Note above and template below this line ----------------------------------------

TestTemplate2

aliases:

  • test2

Test Text 2

Please wrap the contents in separate code blocks. We need to see the raw format.

Ah, I see. So you want to update YAML with templates.

  1. Can you show us the template?
  2. How many notes are we looking at?

Yes i want to update the YAML frontmatters with templates - especial aliases. Thanks for the correct wording. English is not my mothertounge :wink:

There will be about 100 notes to update.
The Template i used for the test:
Test_Template2.md (36 Bytes)

There is a bug report familiar to my topic and was posted just a view hours later than my help request:

100 notes is lot of work.

Maybe the easiest way is to install the Global Search and Replace plugin (obsidian://show-plugin?id=global-search-and-replace). You can regex search for the aliases: key and replace it with your additional list values.

At least you only have to confirm 100 times the replacement. :wink:

1 Like

Thanks for your help and your creative input. I think i will use your last suggestion for my notes.

I also found the solution for my problem today:
Untill now I used the external extension “Templater v1.16.0” and with this the aliases didn’merge after inserting the template.
Today i tried the core extension and the mere of aliases works. So i will only use the core extension and im happy with the result.

Thank you all for your input and help to find that solution.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.