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.
Comments
Similar requests
Reusable Field Templates for Consistent and Efficient Schema Design
6 votes · 0 comments
Restrict "Show Hidden Collections" to Admin Users
25 votes · 0 comments
Ability to duplicate a collection or create collection templates
72 votes · 0 comments
Display translated fields in their own columns in the user's language
76 votes · 0 comments
Allow `MailService.send()` to use templates from other sources in addition to file based templates.
1 vote · 0 comments
No comments yet.