Leveraging ViewTemplate in "Missing" tiddlers

52 views
Skip to first unread message

springer

unread,
Jun 18, 2021, 1:54:23 PM6/18/21
to TiddlyWiki
This simple strategy may be obvious to savvy folks, but it felt like magic when I hammered it out, so it's worth a shout-out for novice-intermediate folks:

When a whole category of tiddlers would function just to serve as hubs for related info, don't bother to create the tiddlers. :) 

Instead, set up a ViewTemplate element that serves up the related info. In my case, I populate the custom ViewTemplate with a dynamic table from Shiraz, but you could use any kind of filtered list of links, etc. Ideally, you want to set up a filter condition so that content displays only where needed. (You could even have some default info display exactly when the tiddler does not exist -- but in a way that revolves around whether and how its title appears in other tiddlers' fields -- and evaporate as soon as the tiddler is created.)

I just implemented a variation on this strategy at the logo-contest site, as an easy demo. Entries for Frank B (such as this one) show a subtitle with //Frank B// (from author field) in italics. So, clicking the link might seem useless... BUT, if you click on that "Missing" tiddler link, you'll get a table with all of Frank B's entries. :) 

The template element (which I'm sure could be more streamlined) is here: https://tw-logo-contest.tiddlyhost.com/#%24%3A%2Ftable-if-author

Sure, it would not have been much trouble to create a tiddler for each of the five authors, tag each one (say, as "author"), and then have a tag-based ViewTemplate. That's what I used to do. But making a filter condition that draws on mentions within other tiddlers' fields means you don't have to create the tiddlers at all.

Real tried-and-true use case at scale: When I had 32 students, each needing access to a table of exactly those tiddlers that mentioned their initials in the "list" field, I set up a conditionally-displayed template filtering on "[all[current]listed[]]+[has[§]]" (where § is a not-exactly-legal-yet field-name that I snuck in through Shiraz's dynamic-tables back door; this field is present only on the assignment-oriented tiddlers that list student initials). I could then tell each student: Just add a hashtag with your initials (#JK, or whatever) to our regular URL, and you'll see a summary of your assignment info. 

Two further modifications I made were blanking out the $:/language/MissingTiddler/Hint (to reduce distraction), and editing Shiraz's dtables macro definition, near the beginning, to: emptyMessage:"" (so that I don't have to be so careful about ensuring the filter condition is narrow enough).

While writing this up, I noticed that a more general solution is available through modifying shadow tiddlers $:/core/ui/MissingTemplate or even $:/language/MissingTiddler/Hint ... But my approach lets you recognize specific niches for Missing tiddlers (those whose names appear in the author field, those whose titles are listed in tiddlers with § field, etc.), and to set up different default presentations for each.

Cheers!

-Springer
Reply all
Reply to author
Forward
0 new messages