Skip to content

Commit

Permalink
Fix updated logic
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Aug 30, 2017
1 parent 7006f8c commit 9429f63
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 122 deletions.
2 changes: 1 addition & 1 deletion _includes/2017/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<script src='https://unpkg.com/prismjs@1.6.0/components/prism-bash.min.js'></script>
<script src='https://unpkg.com/prismjs@1.6.0/components/prism-scss.min.js'></script>
<script src='https://unpkg.com/prismjs@1.6.0/components/prism-elixir.min.js'></script>
<script src='https://unpkg.com/prismjs@1.6.0/components/prism-elixir.min.js'></script>
<script src='https://unpkg.com/prismjs@1.6.0/components/prism-ruby.min.js'></script>
{% for lang in page.prism_languages %}
<script src='https://unpkg.com/prismjs@1.6.0/components/prism-{{lang}}.min.js'></script>
{% endfor %}
Expand Down
12 changes: 7 additions & 5 deletions _layouts/2017/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
%}
{% assign recent_pages = site.pages
| where_exp: "page", "page.updated"
| where_exp: "page", "page.updated >= site.last_updated"
| sort: "updated", "first"
%}
{% include 2017/head.html %}
{% include 2017/top-nav.html page=page %}
Expand Down Expand Up @@ -40,10 +40,12 @@ <h2 class='category item' data-js-searchable-header>
<span>Recently updated</span>
</h2>

{% for page in recent_pages %}
{% unless page.tags contains 'Featured' %}
{% include 2017/pages-list-item.html page=page class='article item' %}
{% endunless %}
{% for page in recent_pages reversed %}
{% if forloop.index < 12 %}
{% unless page.tags contains 'Featured' %}
{% include 2017/pages-list-item.html page=page class='article item' %}
{% endunless %}
{% endif %}
{% endfor %}

{% for category in site.category_names %}
Expand Down
1 change: 1 addition & 0 deletions cssnext.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: cssnext
category: CSS
layout: 2017/sheet
updated: 201708.30
weight: -3
---

Expand Down
261 changes: 145 additions & 116 deletions jekyll.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,42 @@ See: [github/pages-gem](https://github.com/github/pages-gem)

### Basic frontmatter

---
layout: post
title: Hello
---
```
---
layout: post
title: Hello
---
Hello! this is my post.
```
{: data-line="1,2,3,4"}

Attach metadata to a page by adding them on top of the page, delimited by `---`.
See: [Front-matter](http://jekyllrb.com/docs/frontmatter/)

### Other frontmatter stuff

permalink: '/hello'
published: false
category: apple
categories: ['html', 'css']
tags: ['html', 'css']
```yaml
permalink: '/hello'
published: false
category: apple
categories: ['html', 'css']
tags: ['html', 'css']
```
### Configuration
source: .
destination: _site
exclude: [dir, file, ...]
include: ['.htaccess']
In `_config.yml`:
{: .-setup}

```yaml
# Optional
source: .
destination: _site
exclude:
- Gemfile
- Gemfile.lock
include: ['.htaccess']
```

See: [Configuration](http://jekyllrb.com/docs/configuration/)

Expand Down Expand Up @@ -384,150 +399,164 @@ real_name: Anne Rice

See: [Collections](http://jekyllrb.com/docs/collections/)

### Code highlighter

```html
{% highlight ruby linenos %}
def show
...
end
{% endhighlight %}
```

Helpers and filters
-------------------
{: .-three-column}

### Dates

```
{{ site.time | date_to_xmlschema }} #=> 2008-11-07T13:07:54-08:00
{{ site.time | date_to_rfc822 }} #=> Mon, 07 Nov 2008 13:07:54 -0800
{{ site.time | date_to_string }} #=> 07 Nov 2008
{{ site.time | date_to_long_string }} #=> 07 November 2008
```ruby
{{ site.time | date: "%Y %m %d" }}
```
{: .-setup}

### Preprocessors
| `date_to_xmlschema` |`2008-11-07T13:07:54-08:00` |
| `date_to_rfc822` |`Mon, 07 Nov 2008 13:07:54 -0800` |
| `date_to_string` |`07 Nov 2008` |
| `date_to_long_string` |`07 November 2008` |
| `date:` _'%Y %m %d'_ |`2017 Nov 7` |

```
| textilize
| markdownify
| jsonify
| sassify
| scssify
```
### Preprocessors

### Array filters

```ruby
{{ page.description | markdownify }}
```
{{ site.pages | where: "year","2014" }}
```
{: .-setup}

```
| where: "year","2014"
| where_exp: "item", "item.year >= 2014"
| group_by: "genre" #=> { name, items }
| sort
| sort: 'author'
```
| Filter | Description |
| --- | --- |
| `textilize` | Textile |
| `markdownify` | Markdown |
| `jsonify` | JSON |
| `sassify` | Sass |
| `scssify` | SCSS |
| `smartify` | Smartypants |

```
| first
| last
| join: ","
| array_to_sentence_string #=> "CSS, JS and HTML"
```
### Array filters

```ruby
{{ site.pages | where: "year", "2014" }}
```
| map: "post" # works like 'pluck'
| size
```
{: .-setup}

```
{% assign list = list | push: 'd' %}
```
| Filter | Description |
| --- | --- |
| `where:` _"year", "2014"_ | |
| `where_exp:` _"item", "item.year >= 2014"_ | |
| --- | --- |
| `group_by:` _"genre"_ |`{name, items}` |
| `group_by_exp:` _"item", "item.genre"_ |`{name, items}` |
| --- | --- |
| `sort` | |
| `sort:` _'author'_ | |
| --- | --- |
| `uniq` | |
| --- | --- |
| `first` | |
| `last` | |
| `join:` _','_ | |
| `array_to_setentence_string` |`"X, Y and Z"` |
| --- | --- |
| `map:` _'post'_ | Works like 'pluck' |
| --- | --- |
| `size` | |
| `push:` _'xxx'_ | Adds an item |

### String filters

```rb
| default: "xxx"
```

```rb
| upcase
| downcase
```

```rb
| remove: "<p>"
| replace: "super", "mega"
| remove_first: "<p>"
| replace_first: "super", "mega"
```

```rb
| truncate: 5
| truncatewords: 20
```

```rb
| prepend: "Mr. "
| append: " Sr."
```

```rb
| camelize
| capitalize
| pluralize
| strip_html
| strip_newlines
| newline_to_br
```

```rb
| split: ','
```

```rb
| escape
| escape_once
```ruby
{{ page.title | default: "xxx" }}
```
{: .-setup}

```rb
| slice: -3, 3
```
| Filter | Description |
| --- | --- |
| `default:` _'xxx'_ | |
| --- | --- |
| `upcase` | |
| `downcase` | |
| --- | --- |
| `remove:` _'p'_ | |
| `replace:` _'super', 'mega'_ | |
| `remove_first:` _'p'_ | |
| `replace_first:` _'super', 'mega'_ | |
| --- | --- |
| `truncate:` _5_ | |
| `truncatewords:` _20_ | |
| --- | --- |
| `prepend:` _'Mr. '_ | |
| `append:` _'Jr.'_ | |
| --- | --- |
| `camelize` | |
| `capitalize` | |
| `strip_html` | |
| `strip_newlines` | |
| `newlines_to_br` | |
| --- | --- |
| `split:` _','_ | |
| --- | --- |
| `escape` | |
| `escape_once` | |
| --- | --- |
| `slice:` _-3, 3_ | |

See: [String filters](http://docs.shopify.com/themes/liquid-documentation/filters)

### String filters (Jekyll-only)

```ruby
{{ page.excerpt | number_of_words }}
```
| number_of_words
| slugify
```
{: .-setup}

```rb
| xml_escape #=> CDATA
| cgi_escape #=> foo%2Cbar
| uri_escape #=> foo,%20bar
```
| Filter | Description |
| --- | --- |
| `number_of_words` | |
| `slugify` | |
| --- | --- |
| `xml_escape` |`CDATA` |
| `cgi_escape` |`foo%2Cbar` |
| `uri_escape` |`foo,%20bar` |

### Numbers

| minus: 2
| plus: 1
| time: 4
| divided_by: 3
| modulo: 2

### Code highlighter

```html
{% highlight ruby linenos %}
def show
...
end
{% endhighlight %}
```
{{ site.posts.size | minus: 2 }}
```
{: .-setup}

| Filter | Description |
| --- | --- |
| `minus:` _2_ | |
| `plus:` _2_ | |
| `times:` _2_ | |
| `divided_by:` _2_ | |
| `modulo:` _2_ | |
| --- | --- |
| `ceil` | |
| `floor` | |
| `round` | |

Integration
-----------

### Bundler

In `_plugins/bundler.rb`:
{: .-setup}

```rb
```ruby
require "bunder/setup"
Bundler.require :default
```
Expand Down

0 comments on commit 9429f63

Please sign in to comment.