silverbullet/website/Page Decorations.md

35 lines
1.5 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
pageDecoration.prefix: "🎄 "
---
Page decorations allow you to “decorate” pages in various ways.
For now “various ways” means just one way (adding a visual prefix), but in the future, more such decorations will likely be added.
There are two ways to decorate a page.
# Frontmatter
The first is demonstrated in the [[Frontmatter]] of this page, by using the special `pageDecoration` attribute.
# Settings
The more useful way is to apply decorations to pages _dynamically_, you can use the `pageDecorations` attribute in [[SETTINGS]].
Every page decoration has two parts:
* `where`: the [[Expression Language]] expression that has to evaluate to `true` for a given page for that decoration to be applied.
* A set of decorations to apply, see [[#Supported decorations]]
For example:
```yaml
- where: 'tags = "person"'
prefix: "🧑 "
```
This will prefix all pages tagged with `#person` with a 🧑 emoji.
Here on silverbullet.md, we have a decoration like this for pages tagged with #plug: [[Plugs/Emoji]] and [[Plugs/Git]] for instance.
# Supported decorations
For now theres just one:
* `prefix`: A (visual) string prefix (often an emoji) to add to all page names. This prefix will appear in the top bar as well as in (live preview) links to this page. For example, the name of this page is actually “Page Decorations”, but when you link to it, youll see its prefixed with a 🎄: [[Page Decorations]]
Again — later, more such decorations may be added.