60 lines
3.3 KiB
Markdown
60 lines
3.3 KiB
Markdown
# Metadata
|
|
|
|
Markdown articles are rendered as late as possible into HTML, even the [article pages](https://git.marvid.fr/Tissevert/hablo/wiki/Architectural choices#article-pages) only wrap the markdown content into a `<pre></pre>` element. But metadata are still read by hablo when it analyses your blog because some metadata trigger special behaviors.
|
|
|
|
## Format
|
|
|
|
Hablo, just like remarkable, supports YAML-style metadata between lines containing only three `'-'` like this
|
|
|
|
```
|
|
---
|
|
YAML values go here
|
|
---
|
|
```
|
|
|
|
The metadata header is expected to be located right before or right after the title, separated only by as many newlines as you want.
|
|
|
|
```markdown
|
|
# Example title
|
|
---
|
|
author: me
|
|
date: 2017-03-18
|
|
---
|
|
|
|
```
|
|
|
|
## Metadata with a special meaning
|
|
|
|
You can of course put any metadata you like in your articles but some metadata will be watched by hablo.
|
|
|
|
### Comments
|
|
|
|
Comments on an article are enabled by setting a `comments` metadata with the [`id`](https://docs.joinmastodon.org/api/entities#status) of a `status` on the fediverse.
|
|
|
|
This means comments are enabled on a per-article basis and can be totally deactivated anytime (although in that case the whole «comment» section disappears so the previous comments won't show anymore). Remember that this per-article setting is not enough in itself, the [--comments-at](https://git.marvid.fr/Tissevert/hablo/wiki/Command-line#comments) option still acts as a «master-switch» : declaring the instance on which to look for the status by its `id` is obviously necessary.
|
|
|
|
```YAML
|
|
comments: 101781535999718634
|
|
```
|
|
|
|
### Date
|
|
|
|
Hablo associates to each article the date when it was written or last edited to sort articles chronologically and to display it. Trying to [reuse](https://git.marvid.fr/Tissevert/hablo/wiki/Architectural%20choices#reuse) as much as possible, this date is by default the «last modified» Unix date of the file that contains the article.
|
|
|
|
You can override this behaviour by setting a `date` metadata. It can contain a date with an optional time (hour and minute) and a timezone, also optional. If you don't set a timezone the current one will be used. Note that this means that some of your article might seem to have their dates «moving» a bit, if for example you set the date for one of your article (but not the timezone), generate your blog, then travel to a place with a very different timezone, and generate your blog again.
|
|
|
|
### Featured image
|
|
|
|
Every article can contain as many pictures as you like, anywhere you like in it. But you can choose one of them (or even one that doesn't appear in your article) to appear in the [open-graph](http://ogp.me/) card of your article, so that it is displayed and «represents» your article when you paste links to it on social media. The exact name of the metadata is `featuredImage`, camel-case, and it expects the site-root relative link of the picture (so the path as seen from your blog by a client accessing it).
|
|
|
|
```YAML
|
|
featuredImage: /media/turtles/olive-ridley.jpg
|
|
```
|
|
|
|
### Summary
|
|
|
|
You can write a short description of your article and use it as the value of its `summary` metadata and this text will be used in the open-graph [description](http://ogp.me/#optional) of the card generated for the article.
|
|
|
|
```YAML
|
|
summary: This week, I'm gonna tell you everything about the olive ridley sea turtle !
|
|
```
|