5 prism_languages: [bash, yaml, ruby]
16 gem install jekyll bundler
20 # Create a new site at `./myblog`
26 # Optional: if you're targeting github-pages,
27 # use this Gemfile instead.
29 source 'https://rubygems.org'
30 gem 'github-pages', group: :jekyll_plugins
35 bundle exec jekyll serve
38 See: [Jekyll quickstart](http://jekyllrb.com/docs/quickstart/)<br>
39 See: [github/pages-gem](https://github.com/github/pages-gem)
54 │ └── 2014-01-01-hello.md
60 ├── _includes/ - partials
79 Hello! this is my post.
81 {: data-line="1,2,3,4"}
83 Attach metadata to a page by adding them on top of the page, delimited by `---`.
84 See: [Front-matter](http://jekyllrb.com/docs/frontmatter/)
86 ### Other frontmatter stuff
92 categories: ['html', 'css']
107 include: ['.htaccess']
110 All config keys are optional.
111 See: [Configuration](http://jekyllrb.com/docs/configuration/)
131 {{ page.description | truncate_words: 20 }}
139 {% for post in site.posts %}
140 <a href="{{ post.url }}">
141 <h2>{{ post.title }}</h2>
142 <p>{{ post.date | date_to_string }}</p>
151 {{ page.date | date: "%b %d, %Y" }}
157 {% if page.image.feature %}
165 {: data-line="1,3,5,7 }
168 {% if page.category == 'React' %}
169 {% if page.category == 'React' or page.featured %}
170 {% if page.tags contains 'Featured' %}
176 {% case shipping.title %}
177 {% when 'international' %}
178 Arriving in 2-3 weeks
179 {% when 'Domestic' %}
182 Thank you for your order!
185 {: data-line="1,2,4,6,8"}
187 ### Includes (partials)
190 {% include header.html %}
195 <!-- Including local vars -->
196 {% include header.html page=page %}
211 ### Top-level variables
214 | `{{ site }}` | Data from `config.yml` |
215 | `{{ page }}` | From frontmatter, and page-specific info |
216 | `{{ content }}` | HTML content (use in layouts) |
217 | `{{ paginator }}` | Paginator |
219 See: [Variables](http://jekyllrb.com/docs/variables/)
228 | `site.time` | Current time |
229 | `site.pages` | List of pages |
230 | `site.posts` | List of blog posts |
231 | `site.related_posts` | List of posts related to current |
232 | `site.categories.CATEGORY` | List |
233 | `site.tags.TAG` | List |
234 | `site.static_files` | List |
239 {{ page.content }} - un-rendered content
241 {{ page.excerpt }} - un-rendered excerpt
244 {{ page.id }} - unique id for RSS feeds
245 {{ page.categories }}
249 {{ page.excerpt | remove: '<p>' | remove: '</p>' }}
250 {{ page.excerpt | strip_html }}
254 <!-- blog pagination: -->
266 {{ site.time | date: "%Y %m %d" }}
270 | `date_to_xmlschema` | → `2008-11-07T13:07:54-08:00` |
271 | `date_to_rfc822` | → `Mon, 07 Nov 2008 13:07:54 -0800` |
272 | `date_to_string` | → `07 Nov 2008` |
273 | `date_to_long_string` | → `07 November 2008` |
274 | `date:` _'%Y %m %d'_ | → `2017 Nov 7` |
280 {{ page.description | markdownify }}
284 | Filter | Description |
286 | `textilize` | Textile |
287 | `markdownify` | Markdown |
291 | `smartify` | Smartypants |
296 {{ site.pages | where: "year", "2014" }}
300 | Filter | Description |
302 | `where:` _"year", "2014"_ | |
303 | `where_exp:` _"item", "item.year >= 2014"_ | |
305 | `group_by:` _"genre"_ | → `{name, items}` |
306 | `group_by_exp:` _"item", "item.genre"_ | → `{name, items}` |
309 | `sort:` _'author'_ | |
316 | `array_to_sentence_string` | → `"X, Y and Z"` |
318 | `map:` _'post'_ | Works like 'pluck' |
321 | `push:` _'xxx'_ | Adds an item |
326 {{ page.title | default: "xxx" }}
330 | Filter | Description |
332 | `default:` _'xxx'_ | |
337 | `remove:` _'p'_ | |
338 | `replace:` _'super', 'mega'_ | |
339 | `remove_first:` _'p'_ | |
340 | `replace_first:` _'super', 'mega'_ | |
342 | `truncate:` _5_ | |
343 | `truncatewords:` _20_ | |
345 | `prepend:` _'Mr. '_ | |
346 | `append:` _'Jr.'_ | |
351 | `strip_newlines` | |
352 | `newlines_to_br` | |
359 | `slice:` _-3, 3_ | |
361 See: [String filters](http://docs.shopify.com/themes/liquid-documentation/filters)
363 ### String filters (Jekyll-only)
366 {{ page.excerpt | number_of_words }}
370 | Filter | Description |
372 | `number_of_words` | |
375 | `xml_escape` | → `CDATA` |
376 | `cgi_escape` | → `foo%2Cbar` |
377 | `uri_escape` | → `foo,%20bar` |
382 {{ site.posts.size | minus: 2 }}
386 | Filter | Description |
391 | `divided_by:` _2_ | |
402 Add this to `_config.yml`:
407 paginate_path: "blog/:num"
410 See: [Paginator](http://jekyllrb.com/docs/pagination/)
415 {{ paginator.page }} - page number
416 {{ paginator.total_posts }}
417 {{ paginator.total_pages }}
418 {{ paginator.per_page }}
421 ### Iterating through posts
424 {% for post in paginator.posts %} ... {% endfor %}
430 {% if paginator.total_pages > 1 %}
431 {% if paginator.previous_page %}
432 <a href="{{ paginator.previous_page_path }}">Previous</a>
439 {{ paginator.next_page }} - page number
440 {{ paginator.next_page_path }}
447 _posts/YEAR-MONTH-DAY-title.md
449 See: [Blogging](http://jekyllrb.com/docs/posts/)
453 ![My helpful screenshot]({{ site.url }}/assets/screenshot.jpg)
455 See: [Image paths](http://jekyllrb.com/docs/posts/#including-images-and-resources)
459 vi _drafts/a-draft-post.md
460 jekyll build --drafts
462 Posts in `_drafts` only show up in development, but not production.
463 See: [Drafts](http://jekyllrb.com/docs/drafts/)
465 ### Defining excerpts
470 excerpt: This post is about cats
473 Hello, let's talk about cats. (···)
476 Put a key `excerpt` in the frontmatter.
477 See: [Excerpts](http://jekyllrb.com/docs/posts/#post-excerpts)
479 ### Displaying excerpts
486 {{ post.excerpt | remove: '<p>' | remove: '</p>' }}
487 {{ post.excerpt | strip_html }}
490 ### Excerpt separator
494 excerpt_separator: <!--more-->
502 Alternatively, you can put excerpts inline in your post by defining `excerpt_separator`.
507 permalink: date # /:categories/:year/:month/:day/:title.html
508 permalink: pretty # /:categories/:year/:month/:day/:title/
509 permalink: none # /:categories/:title.html
512 See: [Permalinks](http://jekyllrb.com/docs/permalinks/)
524 {% for member in site.data.members %}
529 See: [Data](http://jekyllrb.com/docs/datafiles/)
541 # _/authors/a-n-roquelaire.md
543 name: A. N. Roquelaire
549 {% for author in site.authors %}
552 See: [Collections](http://jekyllrb.com/docs/collections/)
557 {% highlight ruby linenos %}
569 In `_plugins/bundler.rb`:
573 require "bunder/setup"
574 Bundler.require :default
579 * [Compass](https://gist.github.com/parkr/2874934)
580 * [Asset pipeline](https://github.com/matthodan/jekyll-asset-pipeline)
586 * [Jekyll docs](http://jekyllrb.com/docs/home/) _jekyllrb.com_
587 * [CloudCannon Jekyll cheatsheet](https://learn.cloudcannon.com/jekyll-cheat-sheet/) _cloudcannon.com_
588 * [Jekyll: templates](http://jekyllrb.com/docs/templates/) _jekyllrb.com_
589 * [Liquid: output](http://docs.shopify.com/themes/liquid-basics/output) _shopify.com_
590 * [Liquid: logic](http://docs.shopify.com/themes/liquid-basics/logic) _shopify.com_
591 * [Liquid: filters](http://docs.shopify.com/themes/liquid-documentation/filters) _shopify.com_
592 * [Liquid for designers](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers) _github.com/Shopify_