Skip to content

How to change a line of tags to a list of tags in yaml? #1347

Answered by Zachatoo
francisHugo asked this question in Help
Discussion options

You must be logged in to vote

Something like this should work

<%*
const file = tp.file.find_tfile(tp.file.path(true));
await app.fileManager.processFrontMatter(file, (frontmatter) => {
  frontmatter.tags = frontmatter.tags.split(" ");
});
-%>

If you're interested in running this on all your notes at once, you may be interested in this script
https://zachyoung.dev/posts/templater-snippets#run-obsidian-frontmatter-formatter-on-every-file

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by francisHugo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants