Yaml dataview and moc's

Things I have tried

I have searched over this forum and have no response. Maybe my question is dumb, sorry if so. I have also checked official obsidian help and what keys are supported.

What I’m trying to do

I wanted to start using yaml and dataview since there’s so many options. At first i was amazed that i could upgrade my notes by hiding metadata into frontmatter.
My first basic note template was like this below, now i want to evolve it into yaml.

status: #new
map: [[]]
date: {{date:YYYY-MM-DD}}

And a first thing that i have problem with is map - what’s above current note?
How to create and manage maps of content using YAML & dataview?
According to obsidian forum there are only four keys natively supported and i don’t see links - so should i exclude my maps from frontmatter?

Sorry but I don’t understand your point.

There’re four keys natively (for example, Obsidian understand the values in tags: as the usual “#tags”), but you can create the fields you want. You just need the follow the right rules/syntax for yaml fields and for Obsidian. For example if you want a link as my-link: "[[my file ]]" you need to use quotes surrounding the backlink (attention: backlinks in frontmatter don’t auto-update and they’re ignored in graph).

About the moc thing, you want to build a map of contents of the current note based on what? the headers/sections? For that dataview isn’t the right tool, because headers aren’t an implicit metadata (only for tasks/lists sub-level).

Thanks for response. Let me clarify:

I have a vault with aprox 150 notes and while learning yaml i wanted to migrated my notes into yaml frontmatter as a first step.

Within my note template (in prev post) i use “map:” element to link note that’s above current note. The goal is to build maps of content and to have clean graph view.

I don’t understand how to change my approach to yaml style.

How to use links in YAML?
Can i use my own element called map inside YAML?
Does my elements would be capable to be use with dataview?

Hope that’s clear

My assumption is:

IF i am able to create a list of pages with dataview than i could automate building maps of content?
So the maps of content would be a list of links created by dataview visible on graph?

Can i do that?

I can’t express an opinion about the map of contents because it depends what moc means to you and how you want to build it.

There’s a lot of “conditions” you need to explore and clarify, because some questions only have an answer if you clarify concrete problems/goals.

  1. Can we use backlinks in yaml? Yes, I already said that. You just need to follow the right syntax.
  2. With dataview you can “target” any field in frontmatter, be it links, numbers, strings, dates, … Again, using the right syntax/format.
  3. About the creation of map of contents with dataview, well, as I said you need to be more concrete, you need to draw some relationship… For example, a chain of inlinks (an inlink to the current file and the inlinks for file linked to the current file… and so one)?
  4. Dataview create a dynamic results, not a static things. So, what we see when we run the code is a “live” render, not a raw content. If the content doesn’t exist in the raw markdown document, then you don’t see the dataview results in the graph view! Maybe there’s a solution for that, but I guess it applies a complex code in javascript with a mix of dataview and obsidian api…

I never try it, but you can explore breadcrumbs plugin…

1 Like

Hey Thanks,

By all that you wrote and exactly point 4 i now understand how to use dataview

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