New answers tagged


Thanks @james smith, that did the trick! Revised code: {% set buttonText = { "video" : "Watch the Video", "podcast" : "Listen Now", "externalLink" : "Visit Site", } %} {# resource is a Matrix fieldtye #} {% set resources = entry.resource.all() %} {% for block in ...


Your example isn't working because block.type is actually a shorthand for block.type.handle. Use the latter instead and it should work. You can tell this is the case by dumping out block.type - it's not a simple string, it's a great big object. buttonText[block.type.handle]

Top 50 recent answers are included