Exported TW not displaying images

I have built a TW in node.js and all works as I expect. The images are stored in a files folder alongside the wiki where it runs locally.

Now I have exported the whole wiki using the method here Publishing TW to the web from node.js uploaded the index.html to some webspace and copied across the files folder so it sits alongside.

The images are not showing. When I inspect the html the url to the image is mangled like this https://www.mydomain.com/test/.\files\myimage.jpg which of course should be https://www.mydomain.com/test/files/myimage.jpg

It is like it still thinks the files are local!?

This is my export command;
tiddlywiki --render "." "index.html" "text/plain" "$:/core/save/all" "publishFilter" "-\[\[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]]"

There has been some previous discussion on this _canonical_uri field fails but the previous solution must have worked as the export I made in 2023 still works.

Anyone any idea what has changed and how to fix it?

Thanks.

Does your service provider also expose the files-directory relative to the index.html file. You will probably need to enable that separately on the config UI of the service provider.

You can test that by your URL eg: https://example.com/files/test.jpg should show the file in the browser. If the browser does not show it, your wiki also can not show it.

How are your _canonical_uri values like? Do you use forward or backward slashes?
Even on Windows forward slashes do work, so I would advise always using forward slashes / in TW paths, esp. in URL/URI.

Fred

I’m using backward slashes .\files\myimage.jpg

That’s interesting, I can see the index.html but images either at the root (i.e. same folder as index.html) or in the /files folder acnnot be seen.

The permissions on the folders in cPanel are 755.

Could you try replacing backwards slashes by forward slashes in one of your tiddlers and see if it still works in nodes, and if it works after export?

Fred

It’s turned out I don’t need to replace the backward with forward slashes.

I had a conversation with my hosting provider (Hostinger), actually with their chatbot. It successfully diagnosed the problem after some tests to show that the problem was that one of the folders in my path was named ‘test’ which happened to be a reserved named and would only allow text and html files under it.

Thanks @pmario for the hint!

2 Likes