Variables, and possibly !include in YAML

I would like to work with variables: For instance I would like to have a date variable “%project1_phase1_start” where I could add other dates, e.g. “%project1_phase1_start”+"%today"+20d.

Or I would like to automaticly add working time counters. So I could create an project status page, where all variables of my working times are added.


I definitely agree. I meant to do a feature request but forgot to. Glad to see this. Below, I pasted a quote from a topic about moving lines from the current heading to the previous heading.


1 Like

If variables are added they could be added in YML files that are dot-prefixed, enabling variable inheritance down to subfolders.

For example, in the root is a file .obsidian-vars.yml that defines three variables A, B, and C. Any file in the vault can then use all three of these variables.

Then in a subfolder there is /subfolder/.obsidian-vars.yml that defines two variables B and D. Any file in that subfolder can use variables A, B, C, and D. Since B was overridden in the subfolder then when a file in the subfolder references B it takes on the value that was defined in /subfolder/.obsidian-vars.yml while A and C retain their original values.

I’m not saying this should be implemented, just that this is potentially a relatively straightforward way for it to be implemented.


Hi, I am looking forwards if these features will demanded by a lot of support.
It will be useful for novel writer to define the characters, nouns, events…

@male_cast = David
{{weapon}} = The big sword

the we can wrote as

@male_cast is holding {{weapon}}

which translate into

David is holding The big sword.

And it can support for workspace level, to folder level.


Hee hee, secret feature … :grin: :nerd_face:

Did you ever try:

Note yaml-var:

yamlvar: "Testing, hello there!"

Note yaml-include:

test: !include [[yaml-var]]

# `=this.test.yamlvar`

(requires Dataview for the =this. syntax)

Be aware that this is not standard YAML (but many YAML preprocessors support it). Plus, it generates YAMLWarning: Unresolved tag: !include … in the console.

Seems either the devs thought ahead, or just the used upstream library supports it. Yay!

Seems !!inc also works. So maybe just CodeMirror uses js-yaml and that supports these, or maybe in turn uses yaml-include.

Interestingly enough, Dataview picks it up and Templater doesn’t:

So I’d add to this feature request:

Please officially support the !include (preferred) or !!inc syntax, so we don’t see warnings all the time.

*EDIT: Too bad, so sad! After more testing, I found that it’s not !include working but an odd Dataview “feature”, because using test: [[yaml-var]] turns out to work the same!

Still I’d support this FR, by having !include officially supported in YAML frontmatter.

test:: [[yaml-var]]

Will work with dataview