Skip to content

Writing posts

Antoine Mayerowitz edited this page Sep 26, 2018 · 5 revisions

Now that you how to write markdown, you know everything to be able to write a post !

Create a new file

  • Go to the _posts folder. There you should see the list of all previous posts.
  • Create a new file by clicking on create a new file button.
  • You should be redirected to a text editor. The name of your file is very important and should follow this rule:
YEAR-MONTH-DAY-title-(lang).MARKUP

Where YEAR is a four-digit number, MONTH and DAY are both two-digit numbers, (lang) is an optional string of character to avoid filename conflicts, and MARKUP is the file extension representing the format used in the file (in your case, mostly .md). For example, the following are examples of valid post filenames:

2018-12-25-Merry-Christmas.md
2019-01-01-Bonne-annee.md
2020-04-03-exemple-fr.md
2020-04-03-exemple-en.md

DO NOT USE SPECIAL CHARACTERS for filename (only uppercase and lowercase characters, numbers, dashes - and underscores _are valid. NO ACCENT)

Write a post

Once you decided your filename. you can begin to write your post. All blog post files must begin with front matter which is typically used to set a layout or other meta data. Then you can just write plain markdown. Here is an example:

---
layout: post
title:  "My first Blog Post !"
date:   1818-05-05
ref: firstpost
lang: en
anchor: False
---

# My first blog post !

**Hello** everyone. I hope you enjoy this post.

See you *later*.

Let's take a look at front matter:

Variable Value
layout always post do not modify this
title The title of your post that will be printed on the website. Must be between quotation marks.
date Same date as in the filename.
ref This code is used to link articles that are available in multiple languages. To link multilingual articles, they just need to share the same ref variable. Be careful to use a ref only once per set of articles, otherwise bad bugs could happen !
lang Post lang. fr if french, en if english
anchor By default = False, if True, the post will be in front page of the website and will replace the less recent anchored articles.

Don't forget to include the front matter in every post! IMPORTANT: You have to include it between the three dashes --- on top and bottom.

Credits and more info

These informations are from the Jekyll documentation that I highly recommend you to read if you want to know more.

Clone this wiki locally