English
About this handbook

This handbook belongs to the Quartz plugin quartz-layout-box. And it is built with it: this box is a layout box.

It comes from a Markdown file, not from the configuration — which way is better when is in The snippet.

6.2 – What does not work

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-only or mobile-only in a div of its own, and every member of a group in a div of the flex row. Those wrappers are created before the box is asked, and therefore stay even when it returns nothing — an empty div, measured. Without display and without group the sentence above holds exactly.

Why an empty file and not an empty html

html: "" in the configuration would be shorter and does not work: html takes precedence over file even when empty — the swap through file in the frontmatter would never get its turn. The empty file keeps the way through file open.

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. priority applies to the site.