[Templates] Heads-up panel using 'hooks.top' and 'where' attributes of page templates

I find the freedom and minimalism offered by SilverBullet’s templating and end-user programming features very appealing.

I just realized that the ‘hooks.top’ attribute can be used to create a custom dashboard/heads-up panel (that’s displayed on all / selected types of pages) for frequently accessed information or important information that we need to constantly be aware of.

Here is an example of how it could be used:

Since this heads-up panel is visible wherever we are in our SilverBullet space, it can be used for displaying information of deadlines / time left or to serve as an always-visible navigation bar like we see on websites (like Home, Pricing, About Us) with links to major sections of our knowledge base. This could also act as a heads-up area to show the weather, or quote-of-the-day, or statistics about the knowledge base, or statistics based on information we fetch from elsewhere, and probably so much more.

As it felt simple to implement this potentially very useful idea on SilverBullet, I thought to share this experience. If anyone would like the page template I used for this, here it is:

---
tags: template
description: |
  Enables a dynamic, cross-page section (a global dashboard / heads-up panel) which helps you monitor specific information of your choice from anywhere in your SilverBullet space.
hooks.top:
  where: 'true'
  order: 0
---

✨ Today: **{{today()}}**
🕑 Time Left in Day:   **{{timeLeftInDayWithBar()}}**

[[Journal]] [[Todo]] [[Projects]] [[Research]] [[Travel]] 
--                                        -
| Time to Deadline ||
|----------|----------|
|🎮 _Project A_|**{{timeLeftUntil("2025-01-21T20:54:00", "2025-01-27T17:00:00")}}**                |
|🪟 _Project B_|**{{timeLeftUntil("2025-01-21T20:54:00", "2025-01-23T11:30:00")}}**                |

--                                        -

Note: If you are using the default table of contents page template, you will have to change it’s order attribute to 1.

5 Likes

hi, could you share the functions timeLeftInDayWithBar and timeLeftUntil?

thank you!