Move existing tags to frontmatter automatically

Things I have tried

What I’m trying to do

Hi everybody, this my first post (but I’m a silent reader and user of this amazing and helpful forum). Pardon my english as I’m not a native speaker.

I’m starting to use YAML (in order to do some queries in Dataview) but my notes (I have many as most in this forum) have the tags all arround the place. So, my question is if it is possible to move my existing tags to frontmatter automatically or with an existing plugin (I will backup my vault in advance just in case…).

Thanks!

I don’t understand. In Obsidian, tags are defined in the frontmatter. What, exactly, is it that you have all over your place and that you’re calling “tags”?

Tags can be created in any place with the format #tag1, #tag2; or in yaml frontmatter with the syntax tag: tag1, tag2 (tag: or tags:).

2 Likes

Hi, thanks for the replys.

A normal note in my vault would be like this (I will use dummy text):


Lorem ipsum dolor sit amet, consectetur adipiscing elit. In iaculis ex purus, et consectetur urna viverra non. Aenean ac sem et dui cursus hendrerit ut nec quam. Phasellus eleifend sem eget felis gravida, quis tincidunt turpis interdum. Pellentesque vitae nisl in ligula ornare congue.

#tag1
#tag2/subtag2a


So, In this case, I have 2 tags: #tag1, #tag2/subtag2a. I wanted to move this tags to the frontmatter in bulk (due to the large amount of them) to be able to use dataview plugin (only works with data placed in the frontmatter).

Two points:

  • There is a plugin - Metaedit - that works to (re)write data in your notes. But I don’t use it, so, I don’t know if can do anything similar to the intended.
  • About dataview “only works with data placed in the frontmatter”… This is not true. Dataview works with implicit fields (tags are implicit fields, you don’t need to collected them in format key: value) and you can use also inline fields. This means that you don’t need to do anything to work with your tags in dataview. My suggestion is: don’t spend time in changing your tags, spend some time reading plugin documentation. :slight_smile:

https://blacksmithgu.github.io/obsidian-dataview/data-annotation/

1 Like

it works!!!

Thanks a lot! and a have great year!

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