You want something like this:

\define tweet-this(url,title,description)
<a 
href="https://twitter.com/intent/tweet?source=$url$&text=$title$%20$description$&via=anthilemoon";
 
target="_blank" title="Tweet"><img alt="Tweet" 
src="social-icons/Twitter.png" /></a>
\end

<$macrocall $name="tweet-this" url=<<url>> title={{!!title}} 
description={{!!description}} />

put the define at the top of your template and call the macro with the 
macro call widget where you need it. That assumes you have a variable set 
that contains the value of the url under the name url

Further reading: 
https://tiddlywiki.com/#Concatenating%20text%20and%20variables%20using%20macro%20substitution

On Saturday, April 25, 2020 at 12:22:17 AM UTC+2, Anne-Laure Le Cunff wrote:
>
> Hi everyone,
>
> I'm trying to add social sharing links on each page of to my TW-generated 
> website, here is an example:
>
> <a href="https://twitter.com/intent/tweet?source=*{URL}*&text=*{TITLE}*%20
> *{DESCRIPTION}*&via=anthilemoon" target="_blank" title="Tweet"><img 
> alt="Tweet" src="social-icons/Twitter.png" /></a>
>
>
> Where {URL} the url of the current tiddler, {TITLE} is the title of the 
> current tiddler, etc.
>
> My question is: what am I supposed to use to generate these? (in the 
> static view template tiddler)
>
> For example, for *{TITLE}* I tried *<$view field="title"/>* and 
> *{!!title}* and none of them worked.
>
> Couldn't find anything in this list 
> <https://tiddlywiki.com/static/TiddlerFields.html>.
>
> Thank you!
>
> p.s. attached a fun screenshot for your pleasure.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/2a8088da-0ae8-4d05-889d-47fb79e0c90a%40googlegroups.com.

Reply via email to