Wiki with folder hierarchy

Hi! So, after using TiddlyWiki for some time, the number of tiddlers is growing and it is beginning to be difficult to keep overview. I would therefore like to explore the possibility of organizing my tidders and assets using folder and subfolders. What I think would be useful, is to have a hierarchies like

  • Journal notes tagged “Journal” (but not “Public”): \wiki\Journal\2024\04\2024-04-01.tid
  • Public journal notes tagged “Journal” and “Public”: \wiki\Public\Journal\2024\04\2024-04-01P.tid
  • Project tiddlers tagged with a tiddler [e.g., “A”] tagged Project: \wiki\Projects\A\<title>.tid
  • Public tiddlers tagged “Public” get prefix “\Public”: \wiki\Public\<...>\<title>.tid
  • Some other specific tags that produce subfolders

I would also like to have file attachments saved in the subfolders called assets relative to each tiddler (like in Obsidian). E.g., files attached to 2024-04-01 will be kept in \wiki\Journal\2024\04\assets. I don’t think this can be automated within tiddlywiki but may require manual curation or some external scripts that move attachments around. They can probably be included as HTML if that is the simplest. But how can I get TiddlyWiki to understand that these paths are relative to the tiddler?

Have anyone here been thinking anything similar? I haven’t decided yet whether it is best to

  • Keep the full path in the tiddler title ← Plays well with the tree macro, but seem chaotic
  • Keep the full path in a specific field ← Probably best, but need a way to keep them up-to-date if a tag is added/removed
  • Make a specific filter in $:/config/FileSystemPaths for each rule ← Probably also a nice suggestion

I was trying to make a tidder named $:/config/FileSystemPaths with the content

\define names() ([0-9]{4})-([0-9]{2})-([0-9]{2})
[tag[Journal]search-replace::regexp<names>,[Journal/$1/$2/$1-$2-$3]]

But it seems that the \define is not allowed?

When you refer to folders do you mean only within the titles or do your also mean it must also be on disk like with a nodejs server?

  • if titles only, it can be done but there are better ways

Why do your want this?

There are many ways to use tiddlywiki but what are you trying to achive here?

I haven’t tried it, but at a quick guess, it looks as though because Customising Tiddler File Naming requires

The logical path can be customised by creating a $:/config/FileSystemPaths tiddler containing one or more filter expressions, each on a line of its own.

, you won’t be able to add a \define inline. But I can’t see any reason you couldn’t do it in a separate tiddler tagged $:/tags/Macro. I’m guessing this file is simply parsed differently from normal tiddlers.


filesystempath only recognizes filters, because this is a configuration file and cannot write wikitext

What are you using for syntax highlighting in that screenshot?

TW5-Syntax vscode extension

4 Likes

This is a great answer - thank you!