Cheat sheet

Start Jekyll

bundle exec jekyll serve --watch

metadata variables

foo: bar

Let's make a reference to [%foo]

Let’s make a reference to bar

Dev versus Production

    <!-- Use to show DISQUS (for example) comments only in production. -->
    {% if site.production %}
        <!-- prod stuff -->
    {% endif %}
    <!-- Developing a local only feature not ready for production. -->
    {% unless site.production %}
        <!-- local stuff -->
    {% endunless %}


Here is some text containing a footnote[^somesamplefootnote]. You can then continue your thought...

[^somesamplefootnote]: Here is the text of the footnote itself.


This is an example of an inline footnote.[^This is the *actual* footnote.]


Let's cite a fake book.[p. 42][#fake]

[#fake]: John Doe. *A Totally Fake Book*. Vanity Press, 2006.

del, insert, mark

This is {--is --}a test.

This is {–is –}a test.

This {++is ++}a test.

This {++is ++}a test.

This {~~isn't~>is~~} a test.

This {~~isn’t~>is~~} a test.

This is a {==test==}.

This is a {==test==}.


	{% post_url 2010-07-21-name-of-post %}

Path to images

Put images in /_assets/images/ then:

    <img src="{% asset_path thierry.jpg %}" alt="Thierry" />

Or (image markup):

![My helpful screenshot]({% asset_path thierry.jpg %})


Returns encoded Base64 data URI. Use it to embed images into your stylesheets:


Returns URL of compiled asset:


Put extra assets and pages under:

/extras/<post slug (without date)>/

Then link to those images/pages/etc. via:

{% extras_path image.png %}


Completely disable it by including this in front-formatter:

excerpt_separator: ""


    {% include rail.html %}

Pass parameters to an Include

{% include footer.html param="value" %}

These parameters are available via Liquid in the include:

{{ include.param }}

Write number of words

{{ page.content | number_of_words }}

kill jekyll:

	$ ps aux | grep jekyll
	$ kill -9 PID


    $ lsof -wni tcp:4000
    $ kill -9 PID

Write keys from an array

    {% for post in site.posts %}
      <li><span>{{ | date_to_string }}</span> &raquo; <a href="{{ post.url }}">{{ post.title }}</a></li>
    {% endfor %}

    {% for tag in page.tags %}
      <li> <a href="{{ page.tag }}">{{ page.tag }}</a></li>
    {% endfor %}

The list of all Posts with tag TAG.

    {{ site.tags.TAG }}

Array of tags

    tags: [one, two, three]

Plain HTML in YAML

example: >
        HTML goes into YAML without modification
message: |

        <blockquote style="font: italic 12pt Times">
        <p>"Three is always greater than two,
           even for large values of two"</p>
        <p>--Author Unknown</p>
date: 2007-06-01

Post excerpt

    {{ post.excerpt }}

Code highlighting

linenos is optional

    {% highlight css linenos %}
    body { foo: bar;}
    {% endhighlight %}

    permalink: /:title/

    <a href="{{ post.url }}">Read Post</a>

Tweet stuff

Check _config.yml


    {% tweet %}

Suggested tweet:

    {% suggested_tweet %}


    {{ site.suggested_tweet.text }}


Use the gist tag to easily embed a GitHub Gist onto your site:

    {% gist 5555251 %}


<script src=""> </script>

You may also optionally specify the filename in the gist to display:

    {% gist 5555251 %}


<script src=""> </script>

The gist tag also works with private gists, which require the gist owner’s github username:

    {% gist parkr/931c1c8d465a04042403 %}


<script src=""> </script>