Display image from field stored in variable

I’ve got the following:

title: $:/images/jam/pizza-slice
text: --svg code--
title: pizza
tags: kind
icon: $:/images/jam/pizza-slice

And I’m iterating through all kinds with the following:

<$list filter="[tag[kind]]" variable="currentKind">

<!-- currentKind icon should be displayed here -->

<$link to=<<currentKind>> />

</$list>

I’m trying to display each kind's icon right next to its link and no matter what I’ve tried I cannot figure out the correct syntax.

I’ve tried a straight <$transclude $tiddler={{pizza!!icon}} /> and it works, but how can I do the same with a rolling variable instead of a fixed tiddler reference?

PS I know the variable use in this case is superfluous, but this is a simplified example. In my actual case it’s a multi-layered list and it helps me having clear variables on each layer instead of relative <<currentTiddler>>s.

try removing the variable=current kind so the currentTiddler changes instead

As I’ve mentioned, it’s a multi-layered list. I’m using the currentKind variable and the various assumed currentTiddler variables in different levels. If I remove it from the top, all other layers will break.

You can have a look at my sandbox. There’s a option, kind and place already loaded, along with the templatePlace that binds them together. The relevant code begins at !!! All Options, per Kind

I’ve added the following to try to understand what’s going on (available on the sandbox above):

`Icon name`: <$transclude $tiddler=<<currentKind>> $field="icon"/>

`Icon plain`: <$transclude $tiddler=<<currentKind>> $field="icon" $type="text/plain"/>

`Icon svg`: <$transclude $tiddler=<<currentKind>> $field="icon" $type="image/svg+xml" />

I realized it transcludes the name of the tiddler and not its contents. That’s why the Icon svg displays a broken image; it tries to render $:/images/jam/pizza-slice as SVG, not its contents.

Do I need to somehow use a double transclusion (transclude the contents of the transcluded name)? My brain hurts :dizzy_face: