jekyll-tagslist 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -24
- data/lib/jekyll-tagslist/tagslist_tag.rb +13 -0
- data/lib/jekyll-tagslist/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8d5dcd33c254a0322620f4f702891ad7973aba8
|
4
|
+
data.tar.gz: 0e5c8aa8ac0cd025c4d3929a6254a2d5ea28f4ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dacaaf7829394a55fb4b1bf7d709bf4501b5ad007ceabc23198949ab6e0fd6a91b84b0a26fcfc5864517098fd9b99b93ac8c1d7f3a71d7f8a53699a7313b4a5
|
7
|
+
data.tar.gz: 70d43deaa8fb35d7d7efde3c088039b1af62ab8818a9e5dce5375a400ad4db113b06c1b9eb169902d93349c4c826332a2a56c89888f934b647d2fa50783abb3c
|
data/README.md
CHANGED
@@ -3,53 +3,54 @@
|
|
3
3
|
[![Join the chat at https://gitter.im/crispgm/jekyll-tags-list-plugin](https://badges.gitter.im/crispgm/jekyll-tags-list-plugin.svg)](https://gitter.im/crispgm/jekyll-tags-list-plugin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
4
|
![](https://img.shields.io/badge/license-MIT-blue.svg)
|
5
5
|
|
6
|
+
A Liquid tag plugin for Jekyll, listed on [https://jekyllrb.com/docs/plugins/](https://jekyllrb.com/docs/plugins/).
|
7
|
+
|
6
8
|
## Installation
|
7
9
|
|
8
|
-
```
|
9
|
-
$ gem install jekyll-tagslist
|
10
|
-
```
|
10
|
+
1. Add the following to your site's ```Gemfile```:
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- jekyll-tagslist
|
16
|
-
```
|
12
|
+
```
|
13
|
+
gem "jekyll-tagslist"
|
14
|
+
```
|
17
15
|
|
18
|
-
|
16
|
+
2. Add the following to your site's ```_config.yml```:
|
17
|
+
|
18
|
+
```
|
19
|
+
gems:
|
20
|
+
- jekyll-tagslist
|
21
|
+
```
|
19
22
|
|
20
|
-
|
21
|
-
<div class="article_tag">
|
22
|
-
{% tags_list :threshold => 1, :show_count => 1, :sort_by => count, :order_by => desc %}
|
23
|
-
</div>
|
24
|
-
```
|
23
|
+
3. Add the following in your site's template(s):
|
25
24
|
|
26
|
-
|
25
|
+
```
|
26
|
+
<div class="article-tag">
|
27
|
+
{% tags_list :threshold => 1, :show_count => 1, :sort_by => count, :order_by => desc, :limit => 20 %}
|
28
|
+
</div>
|
29
|
+
```
|
30
|
+
|
31
|
+
## Usage
|
27
32
|
|
28
33
|
### ```:threshold```
|
29
34
|
* Threshold of tag count
|
30
35
|
* Default Value: 1
|
31
36
|
* Values: Any positive integers
|
32
37
|
|
33
|
-
```:threshold => 1```
|
34
|
-
|
35
38
|
### ```:show_count```
|
36
39
|
* Whether show tag count in tags list
|
37
40
|
* Default Value: 1(which means true)
|
38
41
|
* Set to ```:show_count => 0``` if not need
|
39
42
|
|
40
|
-
```:show_count => 1```
|
41
|
-
|
42
43
|
### ```:sort_by```
|
43
44
|
* Default Value: name
|
44
|
-
* Values: name|count|time
|
45
|
-
|
46
|
-
```:sort_by => count```
|
45
|
+
* Values: ```name|count|time```
|
47
46
|
|
48
47
|
### ```:order_by```
|
49
48
|
* Default Value: asc
|
50
|
-
* Values: asc|desc
|
49
|
+
* Values: ```asc|desc```
|
51
50
|
|
52
|
-
```:
|
51
|
+
## ```:limit```
|
52
|
+
* Default Value: 0
|
53
|
+
* Values: Any positive integers
|
53
54
|
|
54
55
|
# Example
|
55
56
|
|
@@ -25,6 +25,10 @@ module Jekyll
|
|
25
25
|
# Value: name, time, count
|
26
26
|
@sort_by = 'count'
|
27
27
|
|
28
|
+
# Default: 0, no limit
|
29
|
+
# Value: integers
|
30
|
+
@limit = 0
|
31
|
+
|
28
32
|
@show_count = 1
|
29
33
|
|
30
34
|
parse_params
|
@@ -59,10 +63,16 @@ module Jekyll
|
|
59
63
|
end
|
60
64
|
|
61
65
|
html = ""
|
66
|
+
|
67
|
+
tag_count = 0
|
62
68
|
|
63
69
|
tags.each do |tag, count|
|
70
|
+
if tag_count > @limit
|
71
|
+
break
|
72
|
+
end
|
64
73
|
count_html = @show_count == 0 ? "" : "<div class=\"tag-item-count\">#{count}</div>"
|
65
74
|
html << "<div class=\"tag-item\"><div class=\"tag-item-name\">#{tag}</div>#{count_html}</div>\n"
|
75
|
+
tag_count = tag_count + 1
|
66
76
|
end
|
67
77
|
|
68
78
|
html
|
@@ -93,6 +103,9 @@ module Jekyll
|
|
93
103
|
else
|
94
104
|
@sort_by = 'name'
|
95
105
|
end
|
106
|
+
elsif param_name.eql? ':limit'
|
107
|
+
param_value = param_value.to_i
|
108
|
+
@limit = param_value if param_value > 0
|
96
109
|
else
|
97
110
|
next
|
98
111
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-tagslist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Zhang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
90
|
+
rubygems_version: 2.6.6
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: A Liquid tag plugin for Jekyll.
|