Macro(?) to create a field in a selection of tiddlers

Hopefully this is the final step on moving my wiki to node.js and externalising the images.

I would now like to add the _canonical_uri field to my image tiddlers. The logic is easy (I think) the value is .\files\"tiddler name"

Surely someone has been here before?

Thanks.

Try this:

<$button>make _canonical_uri
   <$list filter="[is[image]]">
   <$action-setfield text="" _canonical_uri={{{ [[.\files\]addsuffix<currentTiddler>] }}} />
   </$list>
</$button>

When you click the button, it find all non-shadow tiddlers that have an image MIME ContentType (e.g., image/jpeg, image/gif, image/png, etc.), and sets the _canonical_uri field to the appropriate URI. Note that it also clears the tiddler’s text field, so that the existing base64-encoded binary image content is removed (saving LOTS of space!)

Thanks, that works of course, but it does need a /> at the end of the <$action line!