Front matter format changes in Obsidian 1.9, and how to deal with them

Obsidian 1.9 introduces a breaking change for some of the front matter:

We have officially removed support for the properties tag, alias, cssclass in favor of tags, aliases and cssclasses. In addition, the values of these properties must be a list. If the current value is a text property, it will no longer be recognized by Obsidian.

(Emphasis mine.)

Addendum by Obsidian’s CEO Steph Ango, a few hours later:

The format was changed in Obsidian 1.4. What changed in 1.9 is that we dropped support for the old format which was not correct YAML for arrays.

What this means

When an existing front matter list look like this:

---
tags: tag1, tag2, tag3
---

… then Obsidian 1.9 will no longer parse it, because it expects it to look like this:

---
tags:
  - tag1
  - tag2
  - tag3
---

In effect, this note will have no tags anymore in Obsidian 1.9, even though they’re stored in the YAML (just in the wrong format, it’s not a valid list).

And if you use Actions For Obsidian, and are used to set the tags value in your properties dictionary to a simple comma-separated string (“tag1, tag2, tag3”) and use them with Set Note Properties, like so:

… then Obsidian 1.9 will no longer recognize these tags as tags because the action passes any key/value pairs to Obsidian as they are, so the resulting YAML front matter looks like this:

---
tags: tag1, tag2, tag3
---

… but again, Obsidian 1.9 expects it to look like this:

---
tags:
  - tag1
  - tag2
  - tag3
---

And remember, I use tags as an example – AFAICT, any front matter key containing a list is affected here!

What to change: Option 1 – Change your Shortcuts workflows

In your workflow, collect your tags as a list. You could do that by defining a fixed list (as I did in the example below), or by choosing several items from a fixed list using a Choose from List action.

Then, when defining the input dictionary for the Set Note Properties action, set the tags row to type “Array”, and use that list as the key’s value (by right-clicking the “Value” column).

Pass the dictionary into Set Note Properties, and Obsidian will be happy because it receives your tags in the right format.

What to change: Option 2 – Use Obsidian Linter

I can wholeheartedly recommend the Obsidian Linter plugin which—among other things—can auto-format front matter (including tags).

In Linter’s Settings:

  1. General tab: I set “YAML tags section style” to “multi-line”.
  2. YAML tag: I enabled its “Format YAML Array” setting
  3. General tab: I enabled “Lint on save” which auto-lints any file which is saved.

In effect it means that even if tags is set to “tag1, tag2, tag3” (coming from AFO, for example), it’ll end up in the format that Obsidian 1.9 is expecting.

Once you’ve configured Linter to your liking (and keep in mind, it can do much, much more than just cleaning up YAML sections!), then you might use its “Lint all files in the vault” command, and be done with it. :slight_smile:

1 Like