Hiding frontmatter

There are certain pages that I use frontmatter, but I would like to hide it. One example case is custom decorations, I already see them on the page, I don’t want to look as frontmatter definitions.
Is there a way to hide or fold frontmatter?

2 Likes

This would be very useful, it would allow you to have a panel with metadata and present only those relevant to the display just below and formatted.

You can fold it (Outline: Fold) but this won’t persist. Feel free to create a GitHub issue for it with specifics on how you would like this to work.

Added GitHub Issue, more like an (enhancement).

2 Likes

As a workaround to fully hide it for some pages you can add the following combination of space-style and pageDecoration frontmatter:

Add style that allows to hide frontmatter on pages with css class no-frontmatter:

```space-style
.no-frontmatter .sb-frontmatter {
    display: none;
}
```

Then add cssClasses decoration to the pages where you want to hide it e.g. using frontmatter:

---
pageDecoration:
    cssClasses:
      - no-frontmatter
---

I use it myself for hiding it on prefixed pages, could probably also be done using object decorations for all pages with prefixes. Changing the frontmatter again requires commenting the style so it is really only a workaround and a proper solution would be preferred.

7 Likes

Not a perfect solve, but a great workaround!