External Link using Tiddler Content

96 views
Skip to first unread message

Thomas Stone

unread,
Mar 19, 2020, 6:12:01 AM3/19/20
to tiddl...@googlegroups.com
I am just wondering if a macro must use the HTML "a href" instead of the "[ext[" wikitext to use an external URL stored in a tiddler as the link destination in another tiddler.

1) Create a new tiddler
- Title = "TiddlyWiki Home Page"

2) Create a global macro
- Title = "mcr OneLink"
- Tag = "$:/tags/Macro"
- Content =

```
\define OneLink(UrParentTag)
<a href={{$UrParentTag$}} target="_blank" rel="noopener noreferrer">$UrParentTag$</a>
\end
```

3) Call the macro, passing in the URL tiddler

```
<<OneLink "TiddlyWiki Home Page">>
```

I tried changing the macro definition to use "[ext[" wikitext, but I don't know whether the transclusion could work. The below code doesn't work.

```
[ext[$UrParentTag$ |{$UrParentTag$}]]
```

Mat

unread,
Mar 19, 2020, 1:19:22 PM3/19/20
to TiddlyWiki
I think this should work (untested)

\define OneLink-inner() [ext[$(arg1)$|$(arg2)$}]]

\define OneLink(UrParentTag)
<$vars arg1="""$UrParentTag$""" arg2={{$UrParentTag$}}>
<<OneLink-inner>>
</$vars>
\end

<:-)

Thomas Stone

unread,
Mar 19, 2020, 2:21:10 PM3/19/20
to TiddlyWiki
I got an extra "%7D" (url encoded close curly brace "}") on the end of the url that opens in the new tab.

Thomas Stone

unread,
Mar 19, 2020, 2:25:32 PM3/19/20
to TiddlyWiki
So the first line need to not have that extra curly brace after $(arg2)$

```


\define OneLink-inner() [ext[$(arg1)$|$(arg2)$]]

```

That works now. Thanks for the code.

Mark Kerrigan

unread,
Mar 19, 2020, 6:18:41 PM3/19/20
to TiddlyWiki
Here's another approach I've been using for quite awhile

Reply all
Reply to author
Forward
0 new messages