Front Matter is the meta data block in the beginning of an markdown blog post entry which will be processed by Jekyll to generate HTML webpages.

The block is surrounded by ---, the format is yaml-based.

There are predefined variables and custom variables. Default values, to enforce the ‘Don’t repeat yourself (DIY)’ pattern can be set in the config file.

Predefined values

The most important keys are title, layout (e.g. page or post) and the date when the site was created.

To group the sites there are tags and categories as YAML list. The key category was for a single value and was replaced by categories.

When the boolean key published is set to false, the page will not be copied to target folder _site.

Example of very simple front matter block

---
layout: post
title: Front Matter on my blog
---

Custom values

name values description
lang de or en Language of the post
post_key6   Unique ID for the post
summary string The summary is used for the ‘in a nutshell’ block
uses-codesyntax boolean Enable syntax highlighting for code blocks
line-numbers-codesyntax hidden or shown Show or hide line numbers in code blocks
toc boolean Table of Content

lang

The language of the post de for German and en for English. The default language English.

post_key6

Unique 6-digit ID for the post.

summary

The summary is a short wrap-up of the whole page content. When the summary value is defined then a post shows an In a Nutshell block in the beginning on top of the meta data block. The summary is plaintext, no markdown and html syntax is allowed.

Visual Code Snippet

Visual Studio code supports code snippets. Snippets help to generate static block of code.

Snippet to generate a front matter block

{
  "Insert a Post Header for Jekyll in markdown": {
    "prefix": "kw-jekyll-postheader",
    "scope": "markdown",
    "body": [
      "---",
      "layout: post",
      "title: \"${TM_FILENAME_BASE/\\d{4}-\\d{2}-\\d{2}-//gi}\"",
      "date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND +0200",
      "category: kargware",
      "tags: [ \"jekyll\", \"blog-post\" ]",
      "lang: en",
      "post_key6: $RANDOM_HEX",
      "---"
    ],
    "description": "Insert a post header for jekyll in markdown"
  }
}

Visual Code Extensions