Home

ifPartsunlessParts

IfPartsunlessParts is a conditional mechanism used in modular templating and content composition to select between two sets of parts depending on whether particular parts are present. It is designed for environments where pages, components, or products are assembled from multiple parts and where availability of those parts determines what should be shown.

In practice, the construct allows authors to express that the ifParts branch should be included when the

Semantics commonly involve evaluating a parts-related condition and then rendering the corresponding branch. If the condition

Syntax is typically expressed as a directive or function that takes three elements: a condition about parts,

See also: conditional rendering, fallback content, template directives, mutually exclusive branches.

required
parts
exist,
and
the
unlessParts
branch
should
be
included
when
they
do
not.
It
is
commonly
found
in
template
engines,
component
libraries,
and
configuration
systems
that
manage
content
assemblies,
such
as
dynamic
pages
or
configurable
products.
The
goal
is
to
provide
a
clear,
mutually
exclusive
pathway
for
content
assembly
and
to
support
graceful
fallbacks.
is
true,
the
content
defined
in
the
ifParts
branch
is
used;
if
false,
the
content
in
the
unlessParts
branch
is
used.
Some
implementations
support
more
complex
conditions,
multiple
part
lists,
or
layered
fallback
logic
to
handle
edge
cases
and
to
maintain
a
coherent
user
experience.
an
ifParts
value,
and
an
unlessParts
value.
For
example,
a
detailed
specification
may
be
shown
when
parts
exist,
while
a
concise
overview
is
shown
when
they
do
not.