Blogging with Jekyll

20.12.2020, von Christian Glahn

Jekyll is a static site generator that combines markdown with data rendering. Data is passed in YAML-format and can be used to enrich the content. For Jekyll the data can be passed as part of a page or as a separate file.

For pages and blog posts there is a minimum set of data that is used to describe a page. The main difference between pages and blog posts is that blog posts are included in a so called feed, which is pretty much a journal of articles. All blog posts are sorted in the sequence of their “appearance”. Jekyll is pretty relaxed about the appearance: The publication is encoded into the filename of the post. This is described in the section Blogs and Pages. Apart from the publication date, Jekyll uses the following attributes as meta-data:

  • layout, which MUST be set to post.
  • title, which should be set to the title of the blog post. If the title is missing, then the first header will be used. Because this magic is hard to control and normally undesired, we enforce the presence of title in our posts.
  • author, which points to the author of the article. If author is missing, we will set it to the issuer of the pull request on the same branch as the pull request.
  • tags, which is used to highlight the categories of a blog post. This allows us to organise our posts.

Theoretically, we could use categories as an alternative to tags, but different to tags, categories change where a blog post is stored. This creates some undesireable situations, which is why I do not recommend using categories on our pages.

As the date is an important meta-data element, it should be added in the document as the date-attribute. If this is missing, the linting will extract the date from the post’s filename. This date is automatically included into the pull request. If the post has no date as a filename, then the date of the pull-request is used. This will lead to renaming the post file.

This metadata is important for helping us to keep consistent and allow automated analysis of our content.

metadata blogs style

Share