Option to hide Frontmatter in a preview mode using its property

There are only “Visible”, “Hidden”, and “Source” mode in “Properties in document” setting for managing frontmatter visibility. I would like to set visibility depending on the frontmatter property, for instance, visible: false so that it is hidden.

Use case or problem

You can place a note in sidebars, but you cannot see its content and have to scroll down the small note window. “Hidden” setting is not ideal for every note.

Proposed solution

Current workaround (optional)

Set to “Hidden”

Related feature requests (optional)

Using a cssClass on a note(s) and a CSS snippet can help here.

The snippet:

.no-properties { 
    --metadata-display-reading: none; /* reading view */
    --metadata-display-editing: none; /* live preview */
}

and in the notes you want to hide the Properties in document, include this cssclass:

---
cssclasses: no-properties
---

The no-properties can be named anything you’d like as long as it doesn’t conflict with another cssclass already in use (from a theme, other custom CSS, etc.).

As Properties in document is now hidden for any notes with this cssclass, you’ll need to switch to Source mode to remove it.

1 Like

Is there no way to add a custom property to frontmatter that Obsidian can recognize?

I added the snippet to obsidian.css and it works like a charm. Thank you.