Page Style Templates

Once upon a time, I thought it was kind of cool to prefix my page names with emoji. Those who have seen early demo videos, will remember me using a :closed_book: for books, and :person_curly_hair: for people.

Obviously, this still works, but I’ve been thinking of other ways to tweak the visuals of page links and pages.

Let me dump a concept of how this may work and see what you all think:

Although I’m not 100% convinced of how to do this, the best one I have so far is to “abuse” template hooks for this purpose. It could look as follows:

You’d create a template e.g. named “Book style” with the following frontmatter:

tags: template
hooks.pageStyle:
  where: ‘tags = “book”’
  icon: 📕
  linkColor: red
  linkBgColor: green
  pageBgColor: yellow

As a result, any link to a page that was tagged with “book” (see the where attribute) would now be decorated:

  • It would be prefixed with a book emoji
  • Its link color would be red
  • Its link background color would be green

The pages itself would use yellow as a background color. And the icon would also appear in the page title.

Thoughts?

What I like:

  • Building on the concept of “hooks” into the SB UI
  • Reusing the “where” attribute that is also used for Live Template Widgets to decide whether these widgets should appear in a particular page or not.
  • Extensible: I just threw the “icon”, “linkColor” and “linkBgColor” in here as examples, but if we’d come up with other ways to decorate pages — different fonts for the page. This would be easy to add.

My concern:

  • I’m abusing templates for what’s really not a template, but a type of configuration. The body of this “template” would be ignored. So… it’s kinda weird.
1 Like

I am a Silverbullet old-timer so I have 100+ pages with icons, between daily/weekly pages, people, projects, etc.

I cannot wait for this implementation to be available and clean my files (I would love them to have no special characters in the filename, as it will make it much easier to work with from the terminal and/or other tools).

I would suggest to move all this to STYLES, it feels a more logical place to me than a template.

Another way would be to create a style-type page, maybe DECORATIONS and refer to it from the SETTINGS page.

Lastly, I’d love the icon: parameter to have flexibility. Example:

icon: "🧑 "

(notice the space)

This would give us the option to have the same user experience as right now, i.e, customize it at will

I’ve updated the original post a bit probably while you were replying. Centralizing it in one page is an option, but what I like about the template approach is that it would also be natural to distribute these via Libraries this way and they can be split out and grouped with other templates. Like a meeting page template, a meeting snippet template and now a meeting style template.

I see the point with your “icon” with the space thing. I was contemplating of calling this “prefix” or something to allow any prefix text. Whether it’s emoji or something else. But… I can only really see the use case of emoji, not free form text. And if that’s the only thing you’d put there, deciding on a space there or not. Not sure.

Why wouldn’t you be able to centralize STYLE into a Library?
I believe we can link to it in ‘SETTINGS’ regardless of where it is in the space, no?

I do like the sharing approach, maybe we can merge both ideas.
If not, I obviously would go for your approach too.

As for the prefix, I just used the ‘space’ as an example but others may have other needs. I am very simple, an icon works for me though, I just want a bit of space between it and the title :joy: