Is there a way to create a link [permalink] to a tiddler that doesn't break if the tiddler name changes?

I was wondering if there was a way to create a link to a tiddler that doesn’t break if the tiddler name changes. I wanted to create links to tiddlers from external applications (e.g. Microsoft Word, Teams, Anki). I can create permalinks but they seem to break if the name of the tiddler changes. I quickly skimmed through the following discussions:

But, I still don’t really understand if this is even possible or how you would do it.

1 Like

Reading your title I thought you just need the relink plugin! Relink — flexibility when relinking renamed tiddlers

But I’ve retitled your post, because you seem to be talking about permalinks.

Perhaps this is helpful: Permaviews plugin - Open predefined tiddlers with a customizable permalink

or this: How to customize permalinks?

Remember that permalinks can use any filter language, with a colon after the hashtag, like this: https://tiddlywiki.com/prerelease/#:[tag[About]] (not sure why this forum refuses to include the second closing bracket in the url — copy the whole url to clipboard, including second bracket).

So, if you can nail down anything that you know you’re not going to change in a tiddler (a certain field value, etc.) then you can build a permalink out of that.

Maybe you want to assign a field to this task. Call the field permalink or share or whatever, and give it a simple memorable value that expresses whatever will stay the same for you — even while your title(s) might change.

https://quick-demo.tiddlyhost.com/#:[permalink[bedrock]]

2 Likes

If of use: A Prototype of UID’s for stable permalinks

(BTW: look at the YouTube video in the start post in that thread.)

1 Like

As suggested, you can use a url story filter to link to a tiddler or a set of tiddlers using the created field (or a custom field). You can create a toolbar button for this like this:

<$button tooltip=`${[{$:/language/Buttons/Permalink/Hint}]}$ (stable)` message="tm-copy-to-clipboard" param=`${[{$:/info/url/full}]}$#:[created[${[{!!created}] }$]]` class=<<tv-config-toolbar-class>> >
<% if [<tv-config-toolbar-icons>match[yes]] %>
{{$:/core/images/link}}
<% else %>
<span class="tc-btn-text"><$text text=`${[{$:/language/Buttons/Permalink/Hint}]}$ (stable)`/></span>
<% endif %>
</$button>

In a tiddler with the tag $:/tags/ViewToolbar and the following fields:

  • caption: {{$:/core/images/link}} {{$:/language/Buttons/Permalink/Caption}} (stable)
  • description: {{$:/language/Buttons/Permalink/Hint}} (stable)

demo

3 Likes

Nice and simple solution by @Theophile, I think it should suit most users.

Some general thoughts:

The created date is almost as unique as UUID, while also having a meaning. The only problem is if one creates many tiddlers at once in some automated process. In this case one would have to revert to creating an explicit UUID field. This has other issues though:

  • if all tiddlers are to be given a UUID at creation, it gets complicated with plugins and other modifications that give new ways to create new tiddlers, it will be difficult to keep track of it; but anyone who can view the wiki can create UUID-permalinks to it;
  • if tiddlers are to be given the UUID upon creating the permalink, it is easier to keep track of; but users with view-only rights will not be able to create these permalinks.

So in some situations the UUID field might be a better solution, but I would bet for most of the situations the simplicity of created date wins.

One small modification I’d consider for the created date permalink: use a filter like [created[XXXX]] [[Title]]. This means open tiddlers with this created date or with this title.

  • if the tiddler wasn’t renamed in the meantime, only it will be opened,
  • if the tiddler was renamed and no new tiddler with the original title was created, only the renamed one will be opened, as expected,
  • if the tiddler was renamed, and later a new one with the original title was created, both will be shown; I’d bet this will more often be wanted than unwanted,
  • this has the advantage of the link being human-readable and meaningful (contains title) without the need of applying any formatting/alias to it, wherever it will be used
3 Likes

For the best effect, the filter should be

[created[XXXX] [title[Title]]

e.g.

https://tiddlywiki.com/#:[created[20130822170200000]]%20[title[Community]]

the title operator is necessary to match only existing tiddlers “Title”, and not to display a missing tiddler if the tiddler was renamed.

This makes the link a bit less readable, but I think I’ve chosen the least confusing operator. Other options would be [match[Title]] or [[Title]is[tiddler]]. Or a custom functions like [.permalink[createdDate],[Title]] (if these work in url, I haven’t checked), but then the function must be always present and unchanged in the wiki, this would likely be a source of problem and not worth the marginally prettier url.

1 Like

Thanks for the additional info. I didn’t consider creating many tiddlers at once in some automated process and how that might affect the toolbar button if I use only the created date.

I’ll add this to the solution @Theophile provided.

1 Like

I have to correct myself once again, the [title[MissingTiddler]] is identical to [[MissingTiddler]], each will open the MissingTiddler even if it is missing.

To achieve what I was trying to do the filter would have to be [match[MissingTiddler]], [field:title[MissingTiddler]] or [[MissingTiddler]is[tiddler]] – these three will not open MissingTiddler if it is missing.

Here is @Theophile’s button with the updated filter, the whole filter expression will be [created[CreatedDate]] [field:title[Title]], of course you can use match or is[tiddler] just as well.

caption: {{$:/core/images/link}} {{$:/language/Buttons/Permalink/Caption}} (stable)
created: 20240521204702317
description: {{$:/language/Buttons/Permalink/Hint}} (stable)
modified: 20240528122712167
tags: $:/tags/ViewToolbar
title: $:/core/ui/Buttons/stablelink

<$button tooltip=`${[{$:/language/Buttons/Permalink/Hint}]}$ (stable)` message="tm-copy-to-clipboard" param=`${[{$:/info/url/full}]}$#:[created[${[{!!created}]}$]] [field:title[${[{!!title}]}$]]` class=<<tv-config-toolbar-class>> >
<% if [<tv-config-toolbar-icons>match[yes]] %>
{{$:/core/images/link}}
<% else %>
<span class="tc-btn-text"><$text text=`${[{$:/language/Buttons/Permalink/Hint}]}$ (stable)`/></span>
<% endif %>
</$button>

$__core_ui_Buttons_stablelink.json (741 Bytes)