1
0
silverbullet/website/Frontmatter.md

54 lines
1.8 KiB
Markdown
Raw Normal View History

---
status: Complete
tags: meta
---
2022-12-07 16:05:27 +00:00
Frontmatter is a common format to attach additional metadata (data about data) to markdown documents.
2022-11-25 12:36:42 +00:00
2023-11-27 16:12:47 +00:00
In SilverBullet, there are multiple ways to attach [[Metadata]] to a page; frontmatter is one of them.
2023-07-25 15:33:24 +00:00
You create it by starting your markdown document with `---` followed by [[YAML]] encoded attributes and then ending with `---` again. Followed by the regular body of your document. This very page contains some frontmatter, click on it to see the underlying code.
2022-11-25 12:36:42 +00:00
Here is another example:
2022-11-25 12:36:42 +00:00
---
status: Draft
tags:
- tag1
- tag2
---
## This is a section
This is content
For convenience, you may use the `attribute.subAttribute` notation, which internally will expand:
```yaml
attribute.subAttribute: 10
```
to
```yaml
attribute:
subAttribute: 10
```
2023-12-21 17:37:50 +00:00
# Special attributes
While SilverBullet allows arbitrary metadata to be added to pages, there are a few attributes with special meaning:
2022-11-25 12:36:42 +00:00
2023-12-21 17:37:50 +00:00
* `name` (==DISALLOWED==): is an attribute used for page names, _you should not set it_.
* `displayName` (`string`): very similar in effect as `aliases` but will use this name for the page in certain contexts.
* `aliases` (`array of strings`): allow you to specify a list of alternative names for this page, which can be used to navigate or link to this page
* `tags` (`array of strings` or `string`): an alternative (and perhaps preferred) way to assign [[Tags]] to a page. There are various ways to define these, take your pick:
```yaml
tags: tag1, tag2 # with commas
tags: tag1 tag2 # with spaces
tags: "#tag1 #tag2" # with pound signs and quotes (you get completion)
tags: # as a list
- tag1
- tag2
tags: # as a list with pound signs and quotes
- "#tag1"
- "#tag2"
```
2022-11-25 12:36:42 +00:00
2023-12-21 17:37:50 +00:00
In addition, in the context of [[Templates]] frontmatter has a very specific interpretation.