Tiddler title as image name

132 views
Skip to first unread message

Boazter

unread,
Jan 17, 2021, 9:45:01 PM1/17/21
to TiddlyWiki
Bitte, years-long newbie here.... I would like to include images that are the name of the title of each tiddler. The "alt" portion works fine but I can't get the "src" part to work. I've tried encompassing in quotes, single quotes, ampersands and no quotes. I feel it's something basic that I'm missing. My CSS works fine for placing it on the right, but I can't get the image to show. What am I missing?

<img src="_images/{{!!title}}.jpg" alt={{!!title}} class="right" >

Much thanks in advance.

MR

Mark S.

unread,
Jan 17, 2021, 10:28:59 PM1/17/21
to TiddlyWiki
You're attempting to concatenate a field value in a string. Unfortunately it's not quite that simple. This trick usually works, but I haven't tested it so ... hopefully.

<img src={{{ [[_images/]addsuffix{!!title}addsuffix[.jpg]] }}} alt={{!!title}} class="right" />

TG

unread,
Jan 18, 2021, 12:54:10 PM1/18/21
to tiddl...@googlegroups.com
Mark,

Yes, this has worked for me. Much thanks! 

Note to self: Research and practice with "addsuffix"

Thanks again!

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/o4pRIVvP2wo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/99c804d3-cb23-4241-aa30-74e81a9755dbn%40googlegroups.com.

Mark S.

unread,
Jan 18, 2021, 1:44:32 PM1/18/21
to TiddlyWiki
On Monday, January 18, 2021 at 9:54:10 AM UTC-8 Boazter wrote:
Note to self: Research and practice with "addsuffix"


And sometimes "addprefix"
 

TG

unread,
Jan 18, 2021, 1:45:27 PM1/18/21
to tiddl...@googlegroups.com
Yes, thank you!

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/o4pRIVvP2wo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

Soren Bjornstad

unread,
Jan 18, 2021, 6:43:02 PM1/18/21
to TiddlyWiki
A more general way of describing the problem with your example that might help you next time: the value of an HTML attribute like src can be exactly one of four things: a "constant string in quotation marks" that never changes, or a transclusion of a {{{ filter result }}}, {{tiddler field}}, or <<macro call/variable reference>> – but never a combination of two or more of those things.* To make things just a little bit murkier but hopefully not too much, either a single filter or a single macro can be used to create a combination of those things, and then you can pass that result to the HTML attribute, as in Mark's example.

* Actually, there are other syntaxes for a constant string, but that's not relevant here.

TG

unread,
Jan 24, 2021, 1:16:43 PM1/24/21
to tiddl...@googlegroups.com
Thank you, Soren, for this information. I have a lot yet to learn but have been able to do a lot more than I imagined. Tiddlywiki has become an essential tool for me. I appreciate everyone's help and information.

TW Tones

unread,
Jan 24, 2021, 7:34:02 PM1/24/21
to TiddlyWiki
Boazter,

I am building a resource to help with these issues and others where we commonly get confused. Triggered by this thread I am now developing a section specifically in concatenation.

See my resource here in the mean time.  

I favor filtered transclusions {{{ filter result }}}

Regards
Tones

TG

unread,
Jan 26, 2021, 11:36:26 PM1/26/21
to tiddl...@googlegroups.com
This is great, Tones. I look forward to checking this out in more detail. Thank you!

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/o4pRIVvP2wo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages