In this post, we will take a brief look at how to work with Jekyll. We assume that Jekyll has been successfully installed and is working fine.

Content

Jekyll Init

Setting up a new Jekyll site (on GitHub).

  1. create a new repository on Github with the following name: <GitHub User>.github.io
  2. clone that repository to a local dev folder (myJekyllRepo in this example)
  3. create a new Jekyll site in the same local dev folder
  4. in the dev folder, create a _drafts folder
  5. add all files to git in an initial commit
$ git clone https://github.com/<GitHub User>/<GitHub User>.github.io.git myJekyllRepo
$ jekyll new myJekyllRepo
$ cd myJekyllRepo
$ mkdir _drafts
$ git add --all
$ git commit -m "initial commit for myJekyllRepo"
$ git push

Customizing the new Jekyll site.

  1. to come
  2. to come

Jekyll Flow

From a rough idea to a published blog post.

  1. Think of a title (e.g., Jekyll Flow) for your new post.
  2. In your _drafts folder, create a new empty <title>.md file (e.g., jekyll-flow.md)

    $ touch title.md

  3. Add minimal Front Matter

    ---
    layout: <document type>
    title: <title>
    date:   <date>
    categories: <categories>
    tags: <tags>
    ---
    

    where

    • <document type> is post or page (or others, depending on the used layout)
    • <title> is your title
    • <date> is the date the post should be filed under (if omitted, date will be taken from post name, see step 7. below)
    • <categories> is one or more (space seperated) categories the post should be filed under (note: the categories are hierarchical. cat1 cat2 means the post will be filed under /cat1/cat2/...)
    • <tags> is one or more tags that should be associated with the post

    • your new file could look similar to this

      ---
      layout: post
      title: blogging with Jekyll
      date:   2015-10-26
      categories: Jekyll Code
      ---
      This is my new blog post...
      
  4. Start local Jekyll Server with --draft option.

    $ bundle exec jekyll serve --draft

  5. Open newly created post in browser at 127.0.0.1:4000.

  6. Edit-Review Cycle a) edit the contents of your post b) save post (it will automatically be regenerated by Jekyll) c) hit F5 on browser to refresh page d) review post e) while not finished and satisfied, continue with step 6.a)

  7. Once satisfied and ready to publish, move your post from the _drafts to the _posts folder, and prepend the date to the filename (in YYYY-MM-DD-title.md format).

    $ mv _drafts/jekyll-flow.md _posts/2015-10-26-jekyll-flow.md

  8. Start local Jekyll Server without --draft option, and verify that the post is generated and filed as expected.

    $ bundle exec jekyll serve

  9. Commit and push your new post to your remote Github repository

    $ git add _posts/
    $ git commit -m "added a new post"
    $ git push
    
  10. Give Github some time to run Jekyll for you
  11. enjoy your new blog post @ http:\\<GitHub User>.github.io

Hope this helps somehow. :)

Best, Thomas


N.B. The best wishes to my father. It’s his birthday today! :)