Ok so I was kind of close lol. I didn't use the $(...)$ because I thought the vars that created that in the code I had seen was specific to the buttons. I also didn't realize that with core variables they didn't need to be set if you were using the same name. Thanks Eric!
On Wednesday, June 23, 2021 at 12:51:52 AM UTC-4 Eric Shulman wrote: > On Tuesday, June 22, 2021 at 7:45:51 PM UTC-7 [email protected] wrote: > >> ...embed the tiddler title in the url, i.e.: >> > [img[images/{{!!title}}.jpg]] >> But of course that just gets read literally. I've also tried using a >> variable with the same result: >> <$set name="image" value="images/{{!!title}}.jpg"> >> [image[<<image>>]] >> </$set> >> > > The problem is that you can't directly mix field transclusion syntax, > e.g., {{!!fieldname}}, within other wiki syntax, e.g., [img[...]] > > The solution is to define a macro that constructs the desired wiki image > syntax, like this: > \define showImage() [img[images/$(currentTiddler)$.jpg]] > Then, invoke it like this: > <<showImage>> > > Notes: > * By default, within each tiddler, the variable "currentTiddler" holds the > name of the tiddler > * In normal tiddler content, you can use either {{!!title}} or > <<currentTiddler>> to *display* the name of the tiddler > * Within the macro definition, $(...)$ does a *text substitution* of the > indicated variable, where the variable is defined *outside* the macro > * After variable substitutions are done, the resulting macro content is > "returned" for rendering > * Thus, if the above macro is invoked within a tiddler named "Tiddler1", > the macro content returned by <<showImage>> will be: > [img[images/Tiddler1.jpg]], which is the syntax you want. > * To use <<showImage>> in multiple tiddlers, just place the showImage() > macro definition in a tiddler by itself (e.g., "ShowImageMacro"), and then > tag that tiddler with *$:/tags/Macro*. > > Also, as an alternative to using a macro definition to construct the > desired syntax, you could use the <$image> widget with a parameter value > that is assembled using "filtered transclusion", like this: > <$image source={{{ [[images/]addsuffix<currentTiddler>addsuffix[.jpg]] > }}} /> > However, this syntax is obviously more complex to produce the exact same > result. > > enjoy, > -e > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/1e5d1b89-2517-4704-a1b1-98045f357756n%40googlegroups.com.

