Listing Contents Pattern Outside Project
contents: pattern resolves outside the project directory; it matches nothing.
Q-12-17 — Listing Contents Pattern Outside Project
A listing
contents:pattern resolves outside the project directory and matches nothing.
What this means
Each pattern in a listing’s contents: list resolves relative to
the directory of the file it is written in — the listing page’s
own directory for front-matter patterns, the directory holding a
_metadata.yml, or the project root for patterns in
_quarto.yml. A pattern may climb toward the project root with
.. segments (for example ../posts/*.qmd), but it may not
climb above the project root. A pattern that does — say
../../*.qmd written next to _quarto.yml — cannot refer to any
project document, so it matches nothing and this warning fires. The
same rule applies to an inline contents: record’s path: — it
resolves against the directory of the file the record is written in,
and this warning fires if it climbs above the project root too.
Why this happens
Usually one .. too many: the pattern was written for a
different directory layout, or moved along with its file into a
shallower directory.
How to fix
Count the .. segments against the location of the file the
pattern is written in, and adjust the pattern so it stays within
the project directory. Files outside the project cannot appear in
a listing; if the content you want to list lives outside the
project, move it into the project’s directory tree. For a record’s
path:, the same fix applies — recount its .. segments against
the record’s declaring file, or anchor it at the project root with a
leading / instead.