Reduced frontmatter in Reading view

Before Version 1.1.8 the fronmatter shown in Reading view only consisted of tags and aliases, no matter which keys else were present in the frontmatter block.

That view was gone after the update. The only option seems to be to enable the “Show fronmatter” option which then shows the full metadata.

Disabling this option removes the frontmatter compelety from Reading view.

Is there a way to get the former minimalistic frontmatter view back?

I have tags, title, aliases, a created and edited date in my frontmatter and showing all that is distracting.

Things I have tried

Enabled/disabled the “Show fronmatter” option

What I’m trying to do

I’d like to have tags and aliases from the frontmatter block rendered in Reading view but no additional keys.

This should be doable with some CSS. If you turn back on the showing of the frontmatter, it shows all frontmatter, but you can hide stuff you don’t want. Here is an image showing source text, reading view and corresponding DOM elements related to the frontmatter display.

What we can see here is that tags and aliases have the CSS classes of frontmatter-section and respectively mod-aliases and mod-tags, and that the other lines just have the frontmatter-section. So if we generally hide the frontmatter-section, unless it also either of the mod-* classes, you could have what you want.

And then it’s a matter of preferences if you also want to show the frontmatter-container-header.

One variant of this:

div.frontmatter-section {
  display: none !important;
}

.frontmatter-section.mod-aliases,
.frontmatter-section.mod-tags {
  display: flex !important;
}

.frontmatter-container-header {
  display: none !important;
}

Which renders the source and reading view as follows:
image

That should get you going, as to what to change, and hopefully discover what you really want out of the frontmatter section.

(PS! Sadly it seems like one can’t choose to display certain fields from the frontmatter. Only tags and aliases, and then have to make a bulk decision as to whether one wants to see all the other fields or not)

Update 2023-01-05: Regarding the last item, I’ve now also discovered, that we can enable (or disable) single lines from the frontmatter using CSS like shown below:

.frontmatter-container .frontmatter-section:nth-child(4)
{
  display: flex !important;
}

The child counter seems to be off by one, so this would enable the third line in the frontmatter. Play around with it, if needed. Similarily, this could also be used the other way around, if there are particular frontmatter fields you would like to hide. Change it to display: none, and find the correct number for nth-child.

@holroy
A thousand thanks for working out this solution! Works perfectly - awesome!

(PS! Sadly it seems like one can’t choose to display certain fields from the frontmatter. Only tags and aliases, and then have to make a bulk decision as to whether one wants to see all the other fields or not)

I think that’s because tags and aliases are the only keys which are natively supported by Obsidian. However, i only need these two, so that’s perfect.

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