The frontmatter can hide a box, swap its snippet and change its title. What it cannot do is switch on a box that would not otherwise exist.
The reason is in the construction. An instance comes from an entry in the configuration and runs on every page; the frontmatter is read once it is already there. There is no way to create an instance from inside a page that the configuration does not know about.
The way round: empty by default
It is wanted as soon as a box should appear on one page only — a download box on the start page, say. Showing it everywhere and hiding it again on 200 pages is no solution.
Inverting it is one: the box gets an empty snippet as its default, and the one page swaps it for the content.
# in the configuration
options:
file: empty.html # a file of 0 bytes
frontmatterKey: layoutBoxDownload---
# on the start page only
layoutBoxDownload: download.html
---This works because a box without content outputs nothing at all — no empty div, no spacing, no
element in the HTML. On the other 199 pages the instance is there and stays silent.
Two cases where a wrapper does stay behind
Quartz wraps a component with
display: desktop-onlyormobile-onlyin adivof its own, and every member of agroupin adivof the flex row. Those wrappers are created before the box is asked, and therefore stay even when it returns nothing — an emptydiv, measured. Withoutdisplayand withoutgroupthe sentence above holds exactly.
Why an empty file and not an empty
html
html: ""in the configuration would be shorter and does not work:htmltakes precedence overfileeven when empty — the swap throughfilein the frontmatter would never get its turn. The empty file keeps the way throughfileopen.
That is exactly how the download box sits on the start page of QuartzControl, while the embedded copy of the same handbook knows nothing about it.
What else does not work
- A box per folder. There is no rule saying “applies to everything under
notes/”. What helps: a field in the frontmatter of the pages concerned, or a template in the vault that carries it. - Conditions. No expressions, no comparisons. The frontmatter names values, not rules.
- Order per page.
priorityapplies to the site.