Display properties from YAML within note

I’m looking for a way to display selected properties (located in the frontmatter) within their note.
Is there a solution available to achieve something like that?

EDIT: For clarification: I don’t want to show all properties by default and I need them to show up in Reading mode (and exporting to PDF).

Example:

1 Like

You can use Dataview plugin:
https://blacksmithgu.github.io/obsidian-dataview/

1 Like

So you want to hide some of the properties in the frontmatter IN EDITING VIEW and see them all IN READING VIEW, right?

You can do it using a CSS snippet if you are using live preview with the “Properties in document” option set to “Visible”.

For example, if you want to hide “tomorrow” & “yesterday” properties,

.markdown-source-view .metadata-property[data-property-key='tomorrow'],
.markdown-source-view .metadata-property[data-property-key='yesterday'] {
    display: none;
}

If you want to see only “tomorrow” or “yesterday” properties and hide the others,

.markdown-source-view .metadata-property:not([data-property-key='tomorrow']):not([data-property-key='yesterday']) {
    display: none;
}

But you seem to be using source mode. Unfortunately, I don’t have any ideas in this case (except for building a plugin).

Thanks, your second snippet does what I was looking for (for now).

In general I’m looking for a solution to use properties anywhere inside the note. But I think that would be a better fit for a Feature Request or a Plugin idea.

So something like

The author of this note is {{property: Author}} which renders to The author of this note is 👤 John Doe.

Ahh, I noticed that I misunderstood your question. As @AdrianoCzelentano suggests, you can use Dataview inline queries for that purpose.

For example:

The author of this note is `= this.Author`
3 Likes

Wow thanks, I didn’t know of this use for Dataview. Fantastic, solved!

1 Like

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