In the previous article about creating and using metadata (aliases, tags, etc.) using Obsidian YAML, I talked about how to create a valid YAML and add metadata, especially tags to our obsidian notes. Regarding the tags, I also touched on the auto-completion feature. But I still feel the necessity to further explain them. So this article is fully dedicated to helping you create and use tags correctly using YAML.
Create Tags Metadata in YAML
We can easily create tags in YAML like the below:
---
tags: tag_name
---
multiple tags:
---
tags: tag_name1, tag_name2
---
or
---
tags: [tag_name1, tag_name2]
---
or
---
tags:
- tag_name1
- tag_name2
---
Use the Created Tags in YAML for Obsidian Notes
Suppose we already created some tags called content_video
, and content_blog
, then we could directly use them in other notes through YAML code.
---
tags:
- content_video
- content_blog
---
Leverage the Autocompletion of Tags in YAML
Enable the Autocompletion When Using Tags
After tags:
, write a double quote with spacing between the left quote and the beginning value.
---
tags: " #content_video"
---
To write multiple tags with an autocompletion feature, coding like this
---
tags: " #content_video #content_blog "
---
or
---
tags: [" #content_video #content_blog "]
---
or
---
tags:
- " #content_video"
- " #content_blog "
---
Two Benefits of Using Autocompletion for Tags
- Preventing us from creating unnecessary tags which might mess up our tags system in Obsidian.
- Saving our typing efforts.
Use Tags for Other Metadata in YAML
Although we create tags or use tags through the metadata of tags
, we could use the created tags in other metadata.
Say we want to add another metadata called type
to our note.
- Without tags auto-completion:
- With the tags auto-completion:
Use Multiple Tags for Other Metadata in YAML — Dataview Plugin Example
---
tags: [" #content/blog #content/video]
status: " #status/finished"
type:
- " #content/blog"
- " #content/video"
---
The metadata type
is picked up by Obsidian. We could visualize the values for the type
in the table created by Dataview plugin:
As you can see, the YAML code below not only enables the auto-completion for the existing tags but also gets recognized and used by the Obsidian Dataview plugin.
---
type:
- " #content/blog"
- " #content/video"
---
Wrap Up
YAML is an efficient way to create and use tags for our Obsidian notes. Being aware of the details such as autocompletion for tags is very useful for our daily work. In the next article, I will discuss using the Obsidian Dataview plugin. See you there.