Help with dynamic external links

48 views
Skip to first unread message

brianburnham

unread,
Nov 14, 2020, 7:38:27 PM11/14/20
to TiddlyWiki
I've been driving myself crazy trying to get this to work, hoping someone can help.

I'm trying to create an external link to search duckduckgo for the current tiddler's title (url encoded). I found some link examples searching, but none that encoded a variable. Here are two of my many failed attempts. My goal is to add this to the view template once it works.

<a href="https://duckduckgo.com/?q=cheese&ia=<<$view field=title format=urlencoded/ >>">search for <<$view field=title />></a>

[ext[search for {{!!title}}|https://duckduckgo.com/?q={{{ [title<currentTiddler>encodeuricomponent[]] }}} ]]

I end up with links that have markup/code rather than the encoded title. Any tips? Using the latest version in Quine 2 (iOS).

Eric Shulman

unread,
Nov 14, 2020, 8:34:16 PM11/14/20
to TiddlyWiki
On Saturday, November 14, 2020 at 4:38:27 PM UTC-8 brianburnham wrote:
I'm trying to create an external link to search duckduckgo for the current tiddler's title (url encoded).

<a href={{{ [<currentTiddler>encodeuricomponent[]addprefix[https://duckduckgo.com/?q=]] }}} target="_blank">
   search for <<currentTiddler>>
</a>

Notes:
  • You can't embed TW wiki syntax *within* a parameter value
  • But you CAN construct an entire parameter value using wikitext syntax
  • Macros/Variables use DOUBLED angle brackets, <<macroname param param param ...>>
  • Within filter syntax, macros/variables use SINGLE angle brackets.
  • You can't use macros with parameters inside filter syntax.
  • Widgets always use SINGLE angle brackets, <$widgetname param=... param="... />
  • Widgets either have matching <$widgetname ...>content</$widgetname>, or use "short-form", <$widgetname ... /
  • You can't use widgets inside filter syntax
In the above example, target="_blank" is causes the external link to open in a new tab or window.

enjoy,
-e


brianburnham

unread,
Nov 14, 2020, 8:55:38 PM11/14/20
to TiddlyWiki

Thanks Eric!
Reply all
Reply to author
Forward
0 new messages