When/Why use Frontmatter

Things I have tried

Reading posts

What I’m trying to do

I’ve been reading about YAML front matter, also in relation to using Devonthink. I’m still a bit confused on the usage. I have a lot of metadata per note, from the type of note, locations, tags, links, etc. I dont like to see it all the time though as it adds a lot of noise to the doc. so I put it in a foldable, bulleted list so that I can just have “Meta” at the top and unfold it to see more. However this is viewable in preview. I’m not sure if this is such a bad thing, though some people use the metadata for exactly this purpose - to hide it in preview. I’m not clear if there’s a further reason besides the aesthetics. Also, at least in Devonthink, as far as I understand, tags are links are not clickable, they are text only. (I dont think this is also the case with Obsidian right?), so then that seems like a negative.

I know you can also use the plugin to create lists and such from data, but that’s a bit advanced for me to consider now and dont see a current use for it, though I’m looking to see if it can be relevant to my workflow.

In any case, I’m trying to come up with a template for my future notes, and not sure if/when to use front matter. Still a beginner, but I dont want to get 1000 notes into it and realize, I should have done it the other way. thanks!

1 Like

What you’re doing is not yaml - a yaml block is put into triple dashes. Correctly configured, it is interpreted as metadata and not shown in preview mode - see here.

For the basics, please check the obsidian help docs first before asking.

1 Like

Thanks. The way I explained it just the way I was doing it before I learned of YAML… my question is if/when/why do convert some/all of my metadata to YAML, or if to use it going forward, in what cases, etc.

Like always, it all depends on what you would like to do with your notes and how you are using them. I would recommend to at least put the title of the note in your frontmatter. Combined with, for example, the dataview plugin, this gives you a lot of possibilities to create dynamic lists of notes and you are not (only) dependent on your file names (which, often, are shorter and less meaningful than the actual note titles). Anyway, dataview is an incredibly powerful plugin, but certainly needs some time of learning for its more advanced capabilities.

that’s helpful, and basically what I’m looking for… things I can do now, even if I dont get to the advanced stuff yet, that will set me up better for when I do. Are you saying to duplicate the exact note title inside the frontmatter? (Isn’t the note title also the file name? You mentioned it is sometimes shorter)… what would be the sytax? Any other suggesitons for future-proofing?

My note titles are my h1-headings. I keep my file names a bit shorter and don’t use special characters in them (in order to avoid illegal file names).

So, for example, my file could be named “Why use front matter.md”.

My main heading, then, could be:

When/Why use front matter?

In my yaml front matter I would put the title again:

---
title: ["When/Why use front matter?"]
---

I see. cool. and this then allows you to use the plugin to make lists? or what exactly are the benefits? what other things can you do? e.g. why do some people put tags there? and are those tags not clickable like in devonthink?

In my front matter, besides the note’s title, I also include topics/categories, related notes, etc. For literature notes, I include the exact title of the article/book, author’s name, year, etc.

This allows you to create dynamic - and self-updating - lists that show you, for example, all articles by a certain author you have already extracted, grouped by year and/or topic, and so on. I strongly encourage you to play around with the dataview plugin, even with its basic functionalities (which are quite easy to understand) you can do a couple of useful stuff.

Tags you use in front matter can be clicked.

2 Likes

thanks so much. will check it out

I’m noticing here that you’re using brackets and quotes,

title: ["When/Why use front matter?"]

but I’ve seen others use simply

title: When/Why use front matter?

or with quotes

title: "When/Why use front matter?"

Ive also seen people use double colon :: and some use spaces before and after the colons.

is there a difference?

Also I see people just putting the date, but then others say the date has to be in a proper format and some have the date in quotes, some not. so it’s a little confusing. :slight_smile:

p.s. is there a way to have page links in front matter and if so, when is that a good idea? what advantages/disadvantages? I was reading that there are some issues, but it was an old article.

For me, using brackets and quotes feels like the safest way (and gives me some more visual order). To be honest, I am not sure if it really makes a difference… I think, at least you need brackets if you assign more than one value to a key (e.g.: category: [Work, People, ToDo]. I use quotes especially in cases where a value consists of several words (for example a longer title).

Double colons are used, afak, for inline metadata (metadata outside the frontmatter which you can put right into your note). I think the dataview plugin makes use of this.

Regarding page links: If you use the breadcrumbs plugin (I don’t use it for my zettelkasten, but for some other kind of notes in order to create some structured hierarchies), it works with page links in your frontmatter. Besides this, I haven’t detected any useful cases where it makes sense (but I still might miss a couple of use cases…).

1 Like

very interesting. thanks

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