Relative permalink idea?

94 views
Skip to first unread message

David Gifford

unread,
Nov 28, 2019, 7:13:47 AM11/28/19
to tiddl...@googlegroups.com
Hi all

I have an idea, but am not sure what to think about it.

In my own notetaking system, I have a central TW with summaries of my notes, and several book TWs, each containing excerpts from multiple books I read. In the central TW I have short summary statements about a topic, and links to the relevant tiddler in the book TW. I obtain that link quickly because in my book TWs I have the permalink button visible in the viewtoolbar, and I grab the permalink to the tiddler for that chapter of the book when I am ready to go to the central TW and add summaries of that chapter's contents.

This works really well for my own system, with the caveat that the permalinks are full links to filepath in my computer. At such time as I change computers, I am going to need to make sure the filepath is identical. Woe to me if Windows ever decides to make it impossible to do that.

Anyway, as some of you know, I also publish multiple TWs with web content in Spanish. In that system I just want to link back and forth between files. And here is my problem. If I want to quickly grab the permalink from a tiddler in one TW and paste it in the tiddler of another TW, the permalink will be to the filepath in my local computer. But when I publish that to the web, that won't help anyone. It needs to be a link to the tiddler in the TW on the web, with an URL, not a local filepath.

So I wondered if there would be a way to clone the shadow permalink tiddlers and create a parallel permalink system that, instead of grabbing the full filepath, is set up to grab only the filename and tiddler anchor (i.e., currentfilename.html#current%20tiddler), and prefix it with the predetermined relative path needed to navigate from one tiddler to another, assuming they are in the same folder, or same folder hierarchy, locally or online (say, ../ or something like that).

I did a search for permalink for the shadow tiddlers on tiddlywiki.com, and read them, but don't really understand it well enough to know if this idea is even possible. It seems like the key is "tv-config-toolbar-text", but that is in the core.

So my questions are, given my use case,

1) Is something like what I am suggesting possible?
2) Am I going about it all wrong? Is there a better way to think about my use case? (in my case, using Bob or some other solution to edit yet share online is less appealing, as I already have my own website)

Currently, without the permalink idea, the next fastest system I can think of for pasting permalinks between multiple TWs would be

a) permalink the target tiddler of file A.html and grab only the tiddler part of the filepath (#this%20tiddler)
b) go to the TW where I want the link, and stamp the relative online link to the target tiddler from a list of prefabricated snippets ([ext[link|../fileA.html]])
c) paste the tiddler info from step a after html in step b

This seems more cumbersome and tedious than my current system, where I have one button to add [ext[link|]] and then I just insert the permalink I grabbed from the other file and tiddler. The extra steps are

a) in the target file, taking time to highlight and copy the part of the permalink I need
b) in the file I am editing, digging through a list of snippets in the stamp tool to find the right one, especially if the number of files that I interlink online grows to quite a few, which is quite likely.

[edit: Maybe one stamp with [ext[link|../]] is the answer? And just paste the filename and tiddler anchor from the target file? But I still would like to hear what other ideas you guys come up with.]

Anyway, sorry for the long explanation. But I thought it worth taking your time, because this would be a valuable solution not just for me, but for anyone who wants a system with multiple interlinking TWs that they either want to publish online or send to someone by email or dropbox, but where the interlinking still works no matter what new context the TWs are in.

Blessings, Dave

TonyM

unread,
Nov 28, 2019, 5:46:35 PM11/28/19
to TiddlyWiki
Dave,

I feel for your requirement as I have seen this as an issue for some time. As a result I have being squirreling away ideas for some time. 

Can I suggest just capture the permalinks as they are and then use a macro to rebuild them in an additional link. You can use remove prefix and addprefix to take away file://C:// and replace it with http://wikiname.tiddlyspot/tiddler or what ever

Happy to provide you more but do you see what I am suggesting?

Regards
Tony

David Gifford

unread,
Nov 28, 2019, 6:12:40 PM11/28/19
to TiddlyWiki
I see what you are saying, but I don't understand how the macro would be invoked.

In the target tiddler you are saying to grab the full permalink. So not there. My next step is to go to the tiddler linking to the target. I paste the full permalink. Then what? The macro would be a search and replace? Since there are multiple files, how would it automatically know where the prefix to chop off ends and the filename begins?

I have been experimenting today with this, and am finding the following to work as well as the process I described in my original post:

1) Grab the permalink of the target tiddler starting from the filename and going all the way to the right to include the anchor.
2) In the tiddler linking to the target, click the edit toolbar button I created to stamp [ext[(link)|]]
3) Paste the link in the stamped text from step 2.

TonyM

unread,
Nov 28, 2019, 6:57:44 PM11/28/19
to TiddlyWiki
David,

My Current use of this is a little different perhaps a quick partial outline
  • Copy (crtl-V) or drag and drop any full link on a tiddlywiki from the address bar or elsewhere, permalink etc...
  • Import, An Untitled tiddler is created with the full link inside it, open it.
  • Perhaps rename it and tag it as a link-tiddler
  • Now in a view template tiddler if it is a link tiddler display alternative link forms by removing and adding prefixes etc...
Opening a link tiddler will display the different link versions ready to click

My Own application is not complete but it detects the prefix of the link in the text field eg http:// https:// file://

I have attached the unfinished work so you can see some of the ideas but it is in no way a solution for you.

See how I test the prefix or suffix in $:/PSaT/LinkHandler/viewTemplate

Regards
Tony
linkhandler.json

PMario

unread,
Nov 29, 2019, 6:02:53 AM11/29/19
to TiddlyWiki
Hi Dave,

The problem is, that file-based URLs are handled different than server based URLs. TW offers some $:/info/url/xxx elements, that could be used to create relative links easily ... IF ... they where all server based.

The server based components look like this:

$:/info/url/origin + $:/info/url/pathname + #myTiddlerName%20other-tiddler
http://localhost   + /tw/aa.html          + #myTiddlerName%20other-tiddler

So you can see, origin is your hostname and pathname is the TW file. Everything after # is the hash.


File based looks like this:

$:/info/url/origin + $:/info/url/pathname + #myTiddlerName%20other-tiddler
null               + /C:/Users/Mario/Downloads/aa.html + ..

So ALL the info is part of the pathname, which makes it very hard to separate the elements, because we don't know where.

So we will need at least 2 config parameters:

 - local-origin: /C:/Users/Mario/Downloads
 - local-path: /aa.html   .... this may be /my-local/dir/aa.html

With this info it should be able to create something. ... BUT ... It needs configuration, which is a user interaction and therefore error-prone.

AND /my-local/dir/ may be different between file and server. In my example it is / and /tw . So may be we need 3 config parameters.

Question: How do your paths look like?

-mario

David Gifford

unread,
Nov 29, 2019, 8:48:38 AM11/29/19
to TiddlyWiki
Cool, Tony! Thank you for sharing that.

David Gifford

unread,
Nov 29, 2019, 8:54:51 AM11/29/19
to TiddlyWiki
Hi PMario, thank you for that explanation.

As it turns out, for both my notetaking and the web materials, I can keep all the files in one folder. So as long as I use [ext[|]], I can just add the filename.html#anchor and it works fine both online and on my kompooter. I don't need "path notation" such as /../ etc. So the process I mentioned in my response to Tony works fine, just manually grab the part of the permalink I need and paste it in an external link snippet.

I don't know how to mark threads as completed, but for my concerns, I am all set. Thank you all for your help!

Dave

TiddlyTweeter

unread,
Nov 29, 2019, 10:12:08 AM11/29/19
to TiddlyWiki
Ciao Dave

You can't yourself mark a thread complete. Only another user can. I did . Quirk of the GG.

I see you solved issue no problem="relative addressing"

TT
Reply all
Reply to author
Forward
0 new messages