TiddlySpot Saver: Can TiddlyWiki automatically fill in the url according to the current url?

When configuring the TiddlySpot
Saver. is it possible to leave out the url and have tiddlywiki automatically fill in the url according to the current url?

I currently have a multi-site synchronized tiddlywiki. it is not possible to save to the current site.

I want the tiddlywiki opened from whichever URL I click save to be uploaded to the appropriate URL.

You can get the username from the url by removing .tiddlyspot.com from the $:/info/url/host.
{{{ [{$:/info/url/host}removesuffix[.tiddlyspot.com]] }}}
the tiddlyspot username is saved in $:/UploadName

here’s a button which will switch the username to match the current url:

\define action-set-tiddlyspot-user()
<$action-setfield $tiddler="$:/UploadName" text={{{ [{$:/info/url/host}removesuffix[.tiddlyspot.com]] }}} />
\end
\define show-set-tiddlyspot-user-button-always()yes
<!-- if you change show-set-tiddlyspot-user-button-always to no, the switch button will olnly show if the username doesn't match the current url -->

<$list filter="[{$:/info/url/host}removesuffix[.tiddlyspot.com]trim[]] -[{$:/UploadName}trim[]] [<show-set-tiddlyspot-user-button-always>prefix[yes]]">
<$button class=<<tv-config-toolbar-class>> >
<<action-set-tiddlyspot-user>>
<span class="tc-dirty-indicator">
<span class="tc-btn-text">switch to <$text text={{{ [{$:/info/url/host}removesuffix[.tiddlyspot.com]] }}} /></span>
</span>
</$button>
</$list>

if you add the tag $:/tags/PageControls then it will show in the Tools tab.
You can then expand the tag pill and drag your button up next to the save button.

it might be possible to add the action-setfield to the save-wiki button so that it updates when you click the save button, but I couldn’t test that option.

1 Like

thanks very much.

I add below code to save-wiki button.


\define action-set-upload()
<$action-setfield $tiddler="$:/UploadURL" text={{{ [{$:/info/url/full}] }}} />
\end

<<action-set-upload>>