42 views

Oct 19, 2021, 1:10:22 PMOct 19
to TiddlyWiki
Is there a way to have external links that are in a sense 'portable'?

I want to store the TW file and the external reference material on a usb drive for access.

Thanks.

### Charlie Veniot

Oct 19, 2021, 3:04:37 PMOct 19
to TiddlyWiki
Something I've never tried, and just tried for fun.

I set my _canonical_uri for an image tiddler with a relative path, relative to the location of the TiddlyWiki file.

So wherever my TiddlyWiki file is, the _canonical_uri  = ./CjVeniot/PatrioticMe.jpg seems to work A-1 for that jpeg file.

Same thing for a PDF file I just tested (tiddler's "Type" = applicaton/pdf).

### Mark S.

Oct 19, 2021, 11:42:11 PMOct 19
to TiddlyWiki
There are different ways to handle this. If we're talking images, for instance, the path to your USB might be different on different machines. So being able to change the path in just one place is handy. And being able specify different types of image sources is also handy. For instance, you might have some sources that are on a remote url, some on a usb, and some on CDROM.

Here's one possible macro

\define img(devtype basename)
<$vars devpath={{{[prefix[ImagePath]suffix[-$devtype$]limit[1]get[text]]}}}> <$image source={{{[<devpath>addsuffix<__basename__>]}}} />
</\$vars>
\end

Then if you have your configuration tiddlers in the format ImagePath-<type> where the text has a path like (example ImagePath-files):

./files/

Then you can invoke your image like this

<<img files myimagepage.jpg>>

Or, back to your usb, you might have a config tiddler ImagePath-usb with text D:\mydirectory\myimages\ and invoke like

<<img usb myimagepage.jpg>>

Then when on a different machine, you can change the contents of ImagePath-usb to Z:\mydirectory\myimages\ .

I have an idea for using image tiddlers (e.g. with _canonical_uri) . The advantage of image tiddlers is that if you change the name of a tiddler, you can use relink to change tiddler transclusion automatically. But that's all for now.

### strikke...@gmail.com

Oct 20, 2021, 12:15:12 AMOct 20
to TiddlyWiki
Some years ago, I did as Charlie, explains. I am using several different laptops, they all run the same version of Linux Mint. Each of the laptops has 3 usb ports....and find my tiddlywiki usb - and the images and more, using the usb label.  finding it at /media/user/label

### Charlie Veniot

Oct 20, 2021, 12:55:16 PMOct 20
to TiddlyWiki
Do be careful how you setup your canonical uri.  Try to use "relative paths" to your external files, and avoid "absolute paths."

If you setup absolute paths, they might work well with, say, your Linux laptop, but not work at all on your Windows desktop (i.e. work fine on one device, but not work at all on other ones.)

So relative to the location of the TiddlyWiki file on your USB drive,
• you might have an image that is up one directory:  ..\this_image.jpg
• or in a subdirectory next to your tiddlywiki:  .\this_subdirectory\this_image.jpg
• etc.
Mind you, I'm going based on general knowledge/experience, nothing specific to TiddlyWiki on a USB drive with external files on the same USB drive, and connecting that USB drive to any number of wildly different devices.

On Tuesday, October 19, 2021 at 2:10:22 PM UTC-3 maruadv...@gmail.com wrote: