4 Metadata
Gitea edited this page 2020-10-28 14:28:05 +01:00

Metadata

Markdown articles are rendered as late as possible into HTML, even the 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.

# 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 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 option still acts as a «master-switch» : declaring the instance on which to look for the status by its id is obviously necessary.

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 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 articles 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.

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 card of your article if you've enabled them, 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).

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 of the card generated for the article (like above for the featured image, if they're enabled)

summary: This week, I'm gonna tell you everything about the olive ridley sea turtle !