jekyll-theme-kagami 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea750399edbf13ecc1dd2731504e2902b4384a1c
4
- data.tar.gz: 0acac718e6306d6ded2ca91423ae347f05ca4762
3
+ metadata.gz: 4a9850d7e6176be1bc3063019a3cb0a2289585fa
4
+ data.tar.gz: 958003518ac56c42f90df3cb78df66c7fdd58c31
5
5
  SHA512:
6
- metadata.gz: f7c746d6b7e0d1debc6620d4b5282c29053e4c553fa13cc9d8c15672447e7d1ecc766d42ccf517799df4c72b73efb9be4f1926bbb23e368816707effa76ba2c5
7
- data.tar.gz: 1b3289f21d0ba5b914315fc2a6dca3ad823304624ccec00adadd8f36de7de7cf961e1a4a9b7c385235abccaa80c98c94716dc89abc6d36c5569c627801389259
6
+ metadata.gz: 0e8608eb5be263c53303b949f64df7000276b9b8205dee4688c785949231549259a49ad290b64426f934fcb9f09b97916baf2760041d2e766dd868b63204e797
7
+ data.tar.gz: 004abe4b7cd3243f5fa18b4f82c5b9d89ef4bb1aebbba2ba875207cb4f6048a7a6aeac0982f13dc9ef2f26f3e7ff8ccb34ab8ade90f1c74adc78c29cee80078d
data/README.md CHANGED
@@ -79,6 +79,29 @@ google_analytics: UA-NNNNNNNN-N
79
79
 
80
80
  Google Analytics will only appear in production, i.e., `JEKYLL_ENV=production`
81
81
 
82
+ ### Tags and category
83
+
84
+ Layout file `post-list` supports filters by tag or category. Create pages with following frontmatter will generate a filtered post list.
85
+
86
+ ```yaml
87
+ title: Title of Tag Page
88
+ layout: post-list
89
+ filter:
90
+ - by_tag: tagname
91
+ ```
92
+
93
+ To filter by both category and tags:
94
+
95
+ ```yaml
96
+ filter:
97
+ - by_tag: tagname
98
+ by_category: category
99
+ ```
100
+
101
+ Results from multiple filters are combined (logical 'or') into the result.
102
+
103
+ A more flexible filter strategy is supported by supplying liquid expression to `by_expression` parameter in which post object can be referenced by the name `post`.
104
+
82
105
  ### Enabling MathJax
83
106
 
84
107
  You can use MathJax with Kramdown's [built-in support](https://kramdown.gettalong.org/syntax.html#math-blocks).
@@ -5,7 +5,28 @@ layout: default
5
5
  {% include header.html %}
6
6
 
7
7
  <ul class="post-list">
8
- {% for post in site.posts %}
8
+ {% for rule in page.filter %}
9
+ {% assign posts = site.posts %}
10
+ {% if rule.by_tag %}
11
+ {% assign posts = posts | where_exp: "post", "post.tags contains rule.by_tag" %}
12
+ {% endif %}
13
+ {% if rule.by_category %}
14
+ {% assign posts = posts | where_exp: "post", "post.category == rule.by_category" %}
15
+ {% endif %}
16
+ {% if rule.by_expression %}
17
+ {% assign posts = posts | where_exp: "post", rule.by_expression %}
18
+ {% endif %}
19
+ {% for post in posts %}
20
+ {% assign posts = posts | append: " " | append: post.path %}
21
+ {% endfor %}
22
+ {% endfor %}
23
+ {% if posts %}
24
+ {% assign posts = posts | split: " " | sort | uniq %}
25
+ {% assign posts = site.posts | where_exp: "post", "posts contains post.path" %}
26
+ {% else %}
27
+ {% assign posts = site.posts %}
28
+ {% endif %}
29
+ {% for post in posts %}
9
30
  <li class="post-list-item" data-tags="{{ post.tags | join: " " }}">
10
31
  <a class="post-item-link" href="{{ post.url | relative_url }}" data-date="{{ post.date | date: "%m-%d" }}">
11
32
  {{ post.title | escape }}
@@ -29,12 +50,3 @@ layout: default
29
50
  </li>
30
51
  {% endfor %}
31
52
  </ul>
32
-
33
- <script type="text/javascript">
34
- var argparse = /([^=]+)=(.*)+/;
35
- var h = window.location.hash, h = h && h.substr(1).split('&') || [], filters = {};
36
- h.forEach(function (e) { var p = argparse.exec(e); if (p) filters[decodeURIComponent(p[1])] = decodeURIComponent(p[2]) });
37
- if (filters.tags) document.querySelectorAll('.post-list li').forEach(function (e) {
38
- e.style.display = !!~e.dataset.tags.indexOf(filters.tags) ? '' : 'none'
39
- });
40
- </script>
data/_layouts/post.html CHANGED
@@ -30,7 +30,7 @@ layout: default
30
30
  {% if page.tags.size > 0 %}
31
31
  <ul class="post-tags" aria-label="TagList">
32
32
  {% for tag in page.tags %}
33
- <li><a class="tag-link" href="{{ tag | url_encode | prepend: "/#tags=" | relative_url }}">{{ tag | escape }}</a></li>
33
+ <li><a class="tag-link" href="{{ tag | url_encode | prepend: "/tags/" | relative_url }}">{{ tag | escape }}</a></li>
34
34
  {% endfor %}
35
35
  </ul>
36
36
  {% endif %}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-kagami
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - kamikat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll