[TW5] How to add the alt attribute in an image link macro?

78 views
Skip to first unread message

Suzanne McHale

unread,
May 23, 2015, 1:44:59 AM5/23/15
to tiddl...@googlegroups.com
I have been trying to add the alt="[some text]" attribute to my image thumbnail links for accessibility purposes (as opposed to the "tooltip" text, which in html code is title=[some text]), but nothing seems to be working - when I save the tiddler, the alt text is not there. Ideally I would like to include it in the image link macro I use (as described here) if possible, but nothing I have tried is working, such as:

\define imageLink(url,image,alt)
<a href="images/$url$" target="_self">[img alt="$title$" [$image$]]</a>
\end

I was trying to use the tooltip as the alt image, but it gets messed up when rendered in the html code, and the image does not display:

<a target="_self" href="images/image.jpg"><img alt="$title$" title="image" src="images/tn-image.jpg"></a>

I have no idea what I am doing, so I'm stuck!

Mark S.

unread,
May 23, 2015, 3:42:15 PM5/23/15
to tiddl...@googlegroups.com
I think you want

  alt="$alt$"

Without knowing where your actual image is located or seeing your file paths, I can't comment on the missing image. Make sure your image is in a subdirectory called "images" immediately below your TW file. My version with my directory structure and images worked.

HTH
Mark

Suzanne McHale

unread,
May 24, 2015, 12:00:41 AM5/24/15
to tiddl...@googlegroups.com
It works, finally - thanks!

\define imageLink(url,alt, image)
<a href="images/$url$" target="_self">[img alt="$alt$" [$image$]]</a>
\end
Reply all
Reply to author
Forward
0 new messages