How do insert a template into front matter?

What I’m trying to do

Insert a template into frontmatter.

Things I have tried

I tried inserting a template like normal, by pressing Cmd-Opt-t, and it does nothing. I tried use Templater, and it does nothing.

It only works when the cursor is outside of the front matter.

Switch to Source Mode first, then you can insert templates into front matter normally.

Yes, source mode is the key. The Properties UI is not a normal editor area, so template insertion commands usually do nothing there. I would insert it in Source mode and keep the template output valid YAML, for example no unquoted colon characters inside a value. If you are using Templater, test with one simple field first, then expand it, because a small YAML syntax error can make the properties panel look like the insertion failed.

If your template is specific to properties:

When you insert a template into the active note, all the properties from the template will be added to the note. Obsidian will also merge any properties that exist in your note with properties in the template. (Templates § Template properties - Obsidian Help)