Jekyll Notes and Tips

Every jekyll post must follow the following filename format. Otherwise, the post will NOT be recognized by jekyll.

YEAR-MONTH-DAY-title.md

where YEAR is a four-digit number, MONTH and DAY are both two-digit numbers. For example,

2011-12-31-new-years-eve-is-awesome.md
2012-09-12-how-to-write-a-blog.md

Note: The title in the filename does not have to match the title in the front matter.

Jekyll Categories and Tags

Categories and Tags are two important keys in jekyll. We need to pay attention to their usage in the front matter.

In the post’s front matter, we can use either the key tag for a single entry or tags for multiple entries.

For multiple items in tags, jekyll will automatically split a string entry if it contains whitespace. For example, front matter tag: classic hollywood will be processed into a singular entity "classic hollywood", front matter tags: classic hollywood will be processed into an array of entries ["classic", "hollywood"].

We can also use brackets and commas to define multiple tags where elements can contain whitespace. For example, tags: [weather, classic hollywood] will be processed into ["weather", "classic hollywood"].

The same applies to the keys category and categories.

Note: It is recommended to use tags with brackets for multiple tags and category for one category. For example,

category: cat
tags: [ta, tb and tc, td]

All tags and categories registered on the current site are exposed to liquid templates via site.tags and site.categories.

Jekyll excerpt

We have two ways to display partial posts on the blog pages:

  • use excerpt in the front matter
  • use excerpt_separator in the front matter

For example,

excerpt: "These pre-written contents will be displayed on the blog page instead of any content in the post."
# or
excerpt_separator: <!--more-->
Here is a [link][link-ref].

[link-ref]: https://www.xxx.com

Check out the Jekyll docs for more info on how to get the most out of Jekyll.