@Anne-Laure : I suspect we have been overcomplicating a bit because most of us are not familiar with the static site generation process. If you can walk us through a few details of your setup I think we are close a solution. Short instructions at the end, but please read through everything.
Have you modified this template
from the folder
If so, please post your customized template. If not, where exactly are you using regexp to replace the spaces in file names, and the links to them, with hyphens?
\define tv-filter-export-link() [split[ ]join[-]encodeuricomponent[]]
Assuming it is setup this way, the following filter will get you the file name portion of the url:
[<currentTiddler>subfilter<tv-filter-export-link>]
Since TW doesn't know where your files will be served we need to add in the domain name:
a better way to do this would be to create a tiddler called something like $:/config/static/domain and give it the text value
https://mentalnodes.com/ so that we can re-use and easily change the domain name.
Then the filter for the URL becomes:
[<currentTiddler>subfilter<tv-filter-export-link>addprefix{$:/config/static/domain}]
Putting it all together: (and assuming you aren't doing anything elsewhere to tweak the file names)
At the top of your template:
\define tv-filter-export-link() [split[ ]join[-]encodeuricomponent[]]
Use as:
<$macrocall $name="tweet-this" url={{{ [<currentTiddler>subfilter<tv-filter-export-link>addprefix{$:/config/static/domain}] }}} title={{!!title}} description={{!!description}} />
To get your file names to match, you can use this filter with the RenderCommand when generating static files:
https://tiddlywiki.com/#RenderCommand"[split[ ]join[-]encodeuricomponent[]addsuffix[.html]addprefix[static/]]"
For easier access to the url in the template, you can wrap a set widget around the entirety of the html portion of your template:
\define macros go here
<$set name="url" filter="""[<currentTiddler>subfilter<tv-filter-export-link>addprefix{$:/config/static/domain}]""">
<!------html starts here-->
<<url>> will give you the url, relies on tv-filter-export-link being defined in the template
</$set>
Please let us know if that works. If so, it can likely be further simplified for re-use.