跳到主要內容

ARC 2.0.0-beta.25

Source-binding reference

Reference the four-field source contract without turning a page query into a global variable.

A page- or collection-scope source is a four-field selection contract:

FileMeaningRequired?
<name>A path under /content/<type>/Yes
<name>.sortSort expressionNo
<name>.limitMaximum number of resultsNo
<name>.filterOne filter condition per lineNo

For example, pages/topic/sources/related is a source named related in the topic page scope.

Filter behavior

One filter line is a field/value condition. Multiple lines are ANDed. Comma-separated values on one line are ORed. Current matching is exact and case-sensitive; an object without the named field does not match.

text
tags=AFS,Web Device
category=Research

means “tag contains AFS or Web Device, and category exactly equals Research.” Start with an unfiltered collection before adding a sort, then a limit, then a filter; that makes an empty result diagnosable.

Binding behavior

Use a source as a complete top-level layout prop value, for example:

text
items=$source.related

The name resolves within the relevant page or collection scope. It is not a site-wide variable, and it should not be interpolated into arbitrary prose or assumed to resolve in a nested object. The current source-binding checks can identify an undeclared $source.<name> when the binding scope is knowable; some shared named-layout cases remain outside complete init-time coverage.

An invalid source path returns an empty result rather than reading outside the content root. An empty list can therefore mean a bad path, a filter/locale mismatch, or legitimately no matching objects; inspect the generated page rather than treating all emptiness as one error.

For an authoring walkthrough, see Bind content to a page.