This is something that has been bugging me for a long time. There appears to be no easy way to render an external link where the URL (or text) is derived from a tiddler field.
I often find myself making link tiddlers where I’ve established the convention of adding the URL to a field of the tiddler and then later to my dismay attempt to render it smartly in the body of the tiddler.
The following work but are not ideal:
{{!!url}}
<a class=“tc-tiddlylink-external” href={{!!url}} target=“_blank” rel=“noopener noreferrer”>My Label</a>
There are some concerns with these approaches as the first will not allow you to adjust the text. And the second is unwieldily to type every time.
I’ve tried the following without success:
[[My Label|{{!!url}}]]
[ext[MyLabel|{{!!url}}]]
<$link to={{!!url}}>My Label</$link>
-
\procedure extln(label,href) <a class=“…” href=<<href>> target… rel…><<label>></a>
With<<extln label:”My Label” href:{{!!url}}>>
- Use of
\define
and\function
.
Honestly what do I need to get the simplicity of [[label|url]]
but with the values being filled in from a tiddler field?
This conversation attempted to address the same issue but I was unable to find a resolution in the thread. So far the only working option is to memorize that complicated <a …>
incantation every time and that attempts to DRY this to a \function
or \procedure
won’t work as one would expect.