Dynamic and Nested Templates

Hey Logseq,

I’ve been thinking about workflow automation. Templates scratch the surface, but they could be so much more. Here’s some ideas:

  1. Journals to populate with a different template based on the day of the week, month, or year. Example implementation:
    image

  2. Templates to allow calls to slash commands, such as /today and /template/“template_name”, to dynamically populate the template upon creation, allowing for template reuse and dynamic time and date. Example implementation: ((/today)) ((/current-time)) and ((/template/“Morning Routine”)) would be replaced by Logseq with the results of those slash commands upon use of the parent template.

Less important / Nice to have:

  1. Extend Time and Date slash commands to include current and next first day of week/month/year.
    Bonus 1: Be able to add -X or +X for a relative value inside templates. Example implementation: ((/next-week+1)) could populate with the date for next tuesday, or ((/today+14)) could populate with the date 2 weeks from now.
    Bonus 2: Add commands for the independant month and year values. ex: ((/year+1)) = 2022, [[((/year))-((/month))]] = [[2021-11]]. (Perhaps wrap [[]] in another (()) to avoid collapsing [[]] before template use.)

  2. Embed random child block from a parent block or page. Example implementation: {{random [[Inspirational Quotes]]}}. Perhaps wrap in (()) (or whatever) to select randomly at template creation rather than instantly.
    Bonus: Embed a random Linked reference block of a page. Ex: {{random-linkedref [[Highlights]]}}

Do you guys have any other thoughts or ideas about workflow automation?

Cheers,

MOS

Nice ideas. For example, I would like to give myself a reminder on Friday to go back through the week’s notes. And I would like to give myself a reminder on Tuesday to put the bins out on Wednesday morning!

1 Like

You can try using the logseq smartblocks plugin for this