├── time-current-year.html
├── time-month-day-year.html
├── posts-next-post.html
├── posts-in-category.html
├── layout-page-title.html
├── .editorconfig
├── posts-list.html
├── posts-related.html
├── posts-full.html
├── posts-reading-time.html
├── layout-page-style.html
├── pages-nav.html
├── posts-archive-by-year.html
├── data-list.html
├── atom.xml
├── posts-pagination.html
├── LICENSE
└── README.md
/time-current-year.html:
--------------------------------------------------------------------------------
1 | {{ site.time | date: '%Y' }}
2 |
--------------------------------------------------------------------------------
/time-month-day-year.html:
--------------------------------------------------------------------------------
1 | {{ page.date | date: "%B %-d, %Y" }}
2 |
--------------------------------------------------------------------------------
/posts-next-post.html:
--------------------------------------------------------------------------------
1 | {% if page.next %}
2 |
3 | {{ page.next.title }}
4 |
5 | {% endif %}
6 |
--------------------------------------------------------------------------------
/posts-in-category.html:
--------------------------------------------------------------------------------
1 | {% for post in site.categories.projects %}
2 |
{{ post.title }}
3 | {{ post.content }}
4 | {% endfor %}
5 |
--------------------------------------------------------------------------------
/layout-page-title.html:
--------------------------------------------------------------------------------
1 |
2 | {% if page.title %}
3 | {{ page.title }}
4 | {% else %}
5 | {{ site.title }}
6 | {% endif %}
7 |
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 |
3 | root = true
4 |
5 | [*]
6 | indent_style = space
7 | indent_size = 2
8 | end_of_line = lf
9 | charset = utf-8
10 | trim_trailing_whitespace = true
11 | insert_final_newline = true
12 |
--------------------------------------------------------------------------------
/posts-list.html:
--------------------------------------------------------------------------------
1 |
2 | {% for post in site.posts %}
3 | -
4 |
5 | {{ post.title }}
6 |
7 |
8 |
9 | {% endfor %}
10 |
11 |
--------------------------------------------------------------------------------
/posts-related.html:
--------------------------------------------------------------------------------
1 |
2 | {% for post in site.related_posts limit:3 %}
3 | -
4 |
5 | {{ post.title }}
6 |
7 |
8 |
9 | {% endfor %}
10 |
11 |
--------------------------------------------------------------------------------
/posts-full.html:
--------------------------------------------------------------------------------
1 |
2 | {% for post in site.posts %}
3 |
4 |
9 |
10 |
11 | {{ post.content }}
12 |
13 | {% endfor %}
14 |
15 |
--------------------------------------------------------------------------------
/posts-reading-time.html:
--------------------------------------------------------------------------------
1 | {% comment %}
2 | Paste within a post layout. Change `content` to `page.content` if used within a layout file.
3 | {% endcomment %}
4 |
5 | {% capture words %}
6 | {{ content | number_of_words | minus: 180 }}
7 | {% endcapture %}
8 | {% unless words contains "-" %}
9 | {{ words | plus: 180 | divided_by: 180 | append: " minutes to read" }}
10 | {% endunless %}
11 |
--------------------------------------------------------------------------------
/layout-page-style.html:
--------------------------------------------------------------------------------
1 | {% comment %}
2 | Add the snippet below to your layout to provide override styles on a per-page basis. For example:
3 |
4 | ```
5 | ---
6 | layout: page
7 | title: History
8 |
9 | style: |
10 | .element {
11 | background-color: #333;
12 | }
13 | ---
14 | ```
15 | {% endcomment %}
16 |
17 | {% if page.style %}
18 |
21 | {% endif %}
22 |
--------------------------------------------------------------------------------
/pages-nav.html:
--------------------------------------------------------------------------------
1 | {% comment %}
2 | Dynamically generates a list of links to pages with `layout: page` in the front-matter, sorted alphabetically by URL.
3 | {% endcomment %}
4 |
5 | {% assign pages_list = site.pages | sort:"url" %}
6 | {% for node in pages_list %}
7 | {% if node.title != null %}
8 | {% if node.layout == "page" %}
9 |
10 | {{ node.title }}
11 |
12 | {% endif %}
13 | {% endif %}
14 | {% endfor %}
15 |
--------------------------------------------------------------------------------
/posts-archive-by-year.html:
--------------------------------------------------------------------------------
1 | {% comment %}
2 | Displays a list of posts broken down by year.
3 | {% endcomment %}
4 |
5 | {% for post in site.posts %}
6 | {% capture currentyear %}{{ post.date | date: "%Y" }}{% endcapture %}
7 | {% if currentyear != year %}
8 | {% unless forloop.first %}
9 |
10 | {% endunless %}
11 | {{ currentyear }}
12 |
13 | {% capture year %}{{ currentyear }}{% endcapture %}
14 | {% endif %}
15 | - {{ post.title }}
16 | {% endfor %}
17 |
--------------------------------------------------------------------------------
/data-list.html:
--------------------------------------------------------------------------------
1 | {% comment %}
2 | Shows a list of people's avatars and names, pulled from a data file named `people.yml` in `_data` with the following contents:
3 |
4 | ```
5 | - name: First last
6 | img: first-last
7 | url: http://example.com
8 |
9 | - name: First last
10 | img: first-last
11 | url: http://example.com
12 | ```
13 | {% endcomment %}
14 |
15 |
25 |
--------------------------------------------------------------------------------
/atom.xml:
--------------------------------------------------------------------------------
1 | ---
2 | layout: null
3 | ---
4 |
5 |
6 |
7 |
8 | {{ site.title }}
9 |
10 |
11 | {{ site.time | date_to_xmlschema }}
12 | {{ site.url }}
13 |
14 | {{ site.author.name }}
15 | {{ site.author.email }}
16 |
17 |
18 | {% for post in site.posts %}
19 |
20 | {{ post.title }}
21 |
22 | {{ post.date | date_to_xmlschema }}
23 | {{ site.url }}{{ post.id }}
24 | {{ post.content | xml_escape }}
25 |
26 | {% endfor %}
27 |
28 |
--------------------------------------------------------------------------------
/posts-pagination.html:
--------------------------------------------------------------------------------
1 | {% comment %}
2 | Shows `` elements for non-linked pages and ``s for active links. Automatically accounts for Jekyll's pagination problem where there is no `page1` with a special `if` statement (for when `page == 2`).
3 | {% endcomment %}
4 |
5 |
21 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Mark Otto
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Jekyll snippets
2 |
3 | I'm a big fan of Jekyll. I've built [my blog](http://markdotto.com) on it, as well as [Bootstrap's documentation](http://getbootstrap.com) and a [family of themes](http://getpoole.com). This repository serves as a library of commonly used Jekyll snippets.
4 |
5 | ## Contents
6 |
7 | ### Posts
8 |
9 | - [List of posts](posts-list.html) for archive or condensed index pages.
10 | - [List of posts by year](posts-archive-by-year.html) for archive pages.
11 | - [Series of full posts](posts-full.html) with titles, links, and post body content.
12 | - [Related posts](posts-related.html) based on time.
13 | - [List of posts in a category](posts-in-category.html).
14 | - [Paginated posts](posts-pagination.html) with ``s, ``s, classes, and more.
15 | - [Link to next post](posts-next-post.html).
16 | - [Reading time](posts-reading-time.html)
17 |
18 | ### Pages
19 |
20 | - [Navigation with active class](pages-nav.html) for linking pages with the `layout: page`.
21 |
22 | ### Layout
23 |
24 | - [Page title with site title fallback](layout-page-title.html)
25 | - [Page additional styles](layout-page-style.html) for style exceptions in individual pages.
26 |
27 | ### Data
28 |
29 | - [List of items](data-list.html) from a particular `.yml` file in the `_data` directory.
30 |
31 | ### Time
32 |
33 | - [Current year](time-current-year.html) for things like copyright.
34 | - [Current date](time-month-day-year.html) as full month, day, and year.
35 |
36 | ### Feeds
37 |
38 | - [Basic Atom feed generator](atom.xml)
39 |
40 | ## Contributing
41 |
42 | Have a suggestion or bug fix? Open a pull request or issue. I'd be happy to have more snippets here. Update the list above and include the snippet with a clear file name and the simplest HTML possible.
43 |
44 | ## License
45 |
46 | Licensed under [MIT](LICENSE).
47 |
--------------------------------------------------------------------------------