How to organize nested time-of-day tiddlers under Journal days

Hi all,
I’ve started today using a Tiddlywiki!, but I don’t know how to organize the following structure which is a very simple tiddlers only ‘meals plan’ (for the moment).

Here below is the list of tiddlers I was thinking to create, a conceptually nested structure having as parent the journal of the day, but I’m already blocked on how to name the nested ‘time of day’ to be unique.

Do you have some idea to share?
Thank you!

YEAR-MONTH-DAY (tags: Journal)
→ Morning (tags: Morning)
→ Lunch (tags: Lunch)
→ Evening… (tags: Evening)
→ Midday… (tags: Other)

YEAR-MONTH-DAY+1 (tags: Journal)
→ Morning (tags: Morning)
→ Lunch …

1 Like

Hi @hiberante, welcome to the community!

The tiddler titles have to be unique, there is no way around that. You have probably imagined something like “folders” for each day, each containing tiddlers with the same titles. The way TW works, you have to imagine that all tiddlers are in one “folder”, so their names have to be unique. But there are many other ways to achieve the structure that you need.

I would go for titles like 2024-02-27/Morning and so on.

There are many ways you could make you life easier. If you share some more details of what you would like to do, we might be able to help more. Some loose ideas, guessing what you could need:

  • Have each journal tiddler (tagged Journal) display buttons to create (if not existing) / open (if existing) the specified time of day tiddlers.
  • Have each time of day tiddler display buttons to create / open the “parent” journal or “sibling” times of day tiddlers.
  • Have a page toolbar button to create a time of day tiddler with the current date and time of day based on the current time.
  • Style the title 2024-02-27/Morning so that the date is a bit de-emphasized and the time of day is more prominent, or the other way around, similarly to how system tiddlers (e.g. $:/ControlPanel) de-emphasize the $:/ part.

Let know if you need any further help!

1 Like

Thanks @vilc !
Yes using a ‘folder’-like approach was my thought, but I see now that it is only 1 folder with all tiddlers inside.
The suggestion of using Date/Time was actually what I start doing yesterday before posting here but I wasn’t sure it was a good approach, so thanks for your detailed answer! (and thanks for the hints, indeed it requires some QoL changes which could be introduced incrementally, I had a quick read of the grokTW book, TW is impressive!).

In truth I have still to think/decide why having time-of-day tiddlers can be more useful than placing everything in the same Journal entry (maybe I’m overdoing it).
For example if I use only the Journal entries I would need some structured wikitext, like sections/accordions, one for each time-of-day, that I might need to query with some filter operators; having instead time-of-day as tiddlers I could use TW engine for the querying.

But ok, it seems that I’ll have to first think on how I want to use this ‘meals plan’ :slight_smile:

Thanks again!

  • If you are going to use mostly regular “sections” (e.g. always the same four times of day),
  • if you might want to view/compare certain sections from multiple days (e.g. view all Mornings together),
  • if the individual sections make sense to be viewed on their own, without looking at the rest of the sections or data from that day

then going for separate tiddlers for the sections/times of day is a good idea. If you’re unsure, it is always safer to give the data too much structure (splitting into separate tiddlers) and then collapse/compress, than the other way around.

  • If, on the other hand, you might use “irregular” sections with varying, free-text headings,
  • if their content makes sense only next to the other sections in this day

then storing everything in the day/journal tiddler seems easier and not overdone. If you go this way, the Section Editor plugin might be of your interest. Although my personal view is that if I need section editor for a tiddler, this means that tiddler is too long and should be split. And as a new user, I would try to avoid relying on plugins too much with my data structure.


Grok TW is a great resource, I started with it too. Bear in mind that there are some new nice things in the recent TW versions, which make some of the problems discussed in Grok much easier to solve or understand. If you’re interested, I would suggest taking a quick look at:

1 Like

I think, before you dig deep into, how you want to implement something, it would be better to define your “final result” in plain text, without any implementation details.

The implementation is the last step, after you actually know, what you want.

Tags are very powerful in TW, but as Mateusz (vlic) pointed out, they fall short if you need the same tiddler name, “connecting” it with different elements and “different content”.

The folder like structure, we call TW namespaces, which is used a lot in the core system tiddlers.


From your OP (original post) I can see, That you would like to have YEAR-MONTH-DAY, YEAR-MONTH-DAY+1 … Journal tiddlers.

My first question now is:

  • Do you want to create different journal tiddlers upfront, or are they created each day?
  • Since you mentioned “meals plan” I suspect they should be created upfront. – But I may be completely wrong here. But it makes a difference, for the implementation details.

[You mentioned]

YEAR-MONTH-DAY (tags: Journal)
→ Morning (tags: Morning)
→ Lunch (tags: Lunch)
→ Evening… (tags: Evening)
→ Midday… (tags: Other)

Q2:

  • Is this structure “Morning”, “Lunch”… always the same, or can it be different?

Q3:

  • What should those “Morning”, “Lunch” sections contain?
  • Do they contain the name of the meal?
  • How many different meals are there?

hope that makes sense
-mario

hi @pmario
my initial idea was in fact:

A1:
yes I would create the ‘journal’ tiddlers upfront for the coming days

A2:
Currently they are always the same, I don’t plan to change the time-of-day sections

A3:
the sections will have the name of the meals or even single foods (which will be links to other tiddlers for nutrients details, etc.)

OK. The little word “or” is the tricky one here. So how should it exactly look like, if there

  • is a meal name
  • single food

Q4

  • Is it possible that there is a meal name and single-food, or several single-foods?

Creating Journal tiddlers upfront is a bit tricky, because we do not have a functionality like that out of the box. But it’s relatively straight forward.

TW has an ActionCreateTiddlerWidget that can create new tiddlers with a click of a button.

We do have an unusedtitle Macro which can use a template and a $count$ variable. So it’s possible to create something as follows. There can be a year-selector, a month-selector and the button will create tiddlers 2024-02-00 … 2024-02-01 and so on.

At the moment it has to start with 00, but there is a pending pull-request at GitHub, that will allow us to start with 01.


Creating different meal-tiddlers should be easy. We create a tiddler eg: meal-1 and tag it: meal. These tiddlers can contain all the info that is important for that meal. done :wink:


TW also has the possibility to customize field inputs in edit mode. So eg: every field that has a suffix eg: -meal should show a dropdown, that list all the tiddler tagged: meal (This concept is complex, because the documentation is a bit cryptic) – But the result is cool.

That’s one possible concept, where every field only can have 1 meal assigned.

If 1 field should get more elements more work has to be done.


The screenshots are from a working prototype, which is attached at the end of the post. It allows 1 value per field at the moment.

have fun!
mario

incremental-journal-button-custom-field-dropdowns.json (3.5 KB)

Using the menu(s) approach is actually a great way to solve the meals/foods, I could put food/meals variations in new menu(s) tiddlers (so this answer to the Q4 and the “or” problem :slight_smile:) as there shouldn’t be many.

Thanks a lot for all the info and the prototype!
I’ll give a try with this approach and see how it works out.

You are welcome. If there are any questions, just ask. I did put some links in there, that should point to the documentation of the different elements used.

1 Like

My I also suggest rather than hardcode the following in each Journal tiddler;

  • To save bytes and allow future improvements.
Morning: <$link to={{!!morning-meal}}/>

Lunch: <$link to={{!!lunch-meal}}/>

Evening: <$link to={{!!evening-meal}}/>

Midday: <$link to={{!!midday-meal}}/>

Place the above in a tiddler called meals;

Then create a view template tiddler with the tag $:/tags/ViewTemplate

<$list filter="[tag[Journal]]">
<$transclude tiddler="Meals" mode=block/>
</$list>
  • Now all tiddlers with the tag Journal will display the meals (if they have values)
  • Now the code is in only one copy and all your journal tiddlers are empty and free for other notes.

Later;

  • You can enhance the template to edit the fields in the view template and more
    • Even search for a named meal and set the field.
  • You can change when the meals are listed, why list if there are none in the past, the field is empty.
1 Like

Hi @hiberante – Are you still with us? Did it work out?
-m

1 Like

hi Mario,
thanks for asking. I haven’t given too much time yet but I think the approach discussed should be feasible.