FeatureFuel
5

Conditionally displaying variables in collection display templates

Source: directus/directus#25529 · opened by @JohJonker
Summary Display templates for collections currently allow basic variables. Allowing the conditional display of variables (specifically: introducing an "OR" operator) in the display template would make it even more powerful, especially for page builder use cases. Basic Example Assume that I have a page builder collection heading with three fields: text (required), type (required — 'h1', 'h2', 'h3'), and description (optional). I want to summarise the heading using the display template, so that the user can easily understand which heading it refers to in a page structure. If the user specifies a description, that should always take precedence. However, if the user doesn't specify a description, the heading text should be shown instead. Currently, this does not seem to be possible. It requires 'ugly' workarounds like making the display template {{description}} | {{text}}, which renders as "| Lorem ipsum" if text is sp…

No pledges yet. Be the first to back this.

Make a pledge

Pledge your monetary support if this feature is added.

$

Comments

No comments yet.

Replying to

Add a comment

What do you think about this feature request?


Similar requests