jekyll-index-pages 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +14 -2
- data/.rspec +2 -1
- data/.travis.yml +5 -0
- data/README.md +79 -33
- data/Rakefile +6 -0
- data/jekyll-index-pages.gemspec +3 -2
- data/lib/jekyll-index-pages.rb +3 -0
- data/lib/jekyll-index-pages/archive.rb +14 -0
- data/lib/jekyll-index-pages/author.rb +15 -0
- data/lib/jekyll-index-pages/collection.rb +24 -0
- data/lib/jekyll-index-pages/generator.rb +6 -1
- data/lib/jekyll-index-pages/version.rb +1 -1
- data/script/console +14 -0
- data/script/setup +6 -0
- data/spec/archive_spec.rb +48 -0
- data/spec/author_spec.rb +48 -0
- data/spec/collection_spec.rb +47 -0
- data/spec/fixtures/index-page/_layouts/archive.html +27 -0
- data/spec/fixtures/index-page/_layouts/authors.html +27 -0
- data/spec/fixtures/index-page/_posts/1966-09-08-star-trek-the-original-series.md +1 -0
- data/spec/fixtures/index-page/_posts/1987-09-28-star-trek-the-next-generation.md +1 -0
- data/spec/fixtures/index-page/_posts/1993-01-03-star-trek-deep-space-nine.md +1 -0
- data/spec/fixtures/index-page/_posts/1995-01-16-star-trek-voyager.md +1 -0
- data/spec/fixtures/index-page/_posts/2001-09-26-star-trek-enterprise.md +1 -0
- data/spec/fixtures/index-page/_starships/deep-space-nine.md +4 -0
- data/spec/fixtures/index-page/_starships/enterprise-d.md +4 -0
- data/spec/fixtures/index-page/_starships/enterprise.md +4 -0
- data/spec/fixtures/index-page/_starships/voyager.md +4 -0
- data/spec/generator_spec.rb +66 -2
- metadata +43 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 770086e837c9aa563241ae944838ed44837928b9
|
4
|
+
data.tar.gz: 31beba6daf4d6f047f43a06dcba4548ad6bcd5f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5144398b5b9c427c10a646015ebd2a84de563f245f75543b355cccdb51c90d9a0862f48220cb08bb85cf5f384a0d734d2eec76241be685bd8fbfc28b11d18b51
|
7
|
+
data.tar.gz: 600dee79c356df76d71e302bdaf216de4edb32e87ed9c49d32d472419da96d57c5ef1d786817b9ceda7d1648965561217eae913baca062041a63df62299a552b
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,23 +1,32 @@
|
|
1
1
|
# Jekyll Index Pages
|
2
2
|
|
3
|
+
[](https://travis-ci.org/rukbotto/jekyll-index-pages)
|
4
|
+
|
3
5
|
Index page generator for Jekyll sites. Generates paginated index pages for blog
|
4
|
-
posts, categories and tags.
|
6
|
+
posts, categories and tags. It can also generate a paginated yearly archive,
|
7
|
+
author and collection pages.
|
5
8
|
|
6
9
|
## Installation
|
7
10
|
|
8
|
-
|
11
|
+
Add this line to your Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem "jekyll-index-pages"
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
9
18
|
|
10
19
|
```sh
|
11
|
-
$
|
20
|
+
$ bundle
|
12
21
|
```
|
13
22
|
|
14
|
-
Or
|
23
|
+
Or install it yourself as:
|
15
24
|
|
16
|
-
```
|
17
|
-
gem
|
25
|
+
```sh
|
26
|
+
$ gem install jekyll-index-pages
|
18
27
|
```
|
19
28
|
|
20
|
-
|
29
|
+
Finally add this line to `gems` setting in your `_config.yml` file:
|
21
30
|
|
22
31
|
```yaml
|
23
32
|
gems:
|
@@ -63,33 +72,56 @@ index_pages:
|
|
63
72
|
...
|
64
73
|
```
|
65
74
|
|
66
|
-
|
75
|
+
Yearly archive:
|
67
76
|
|
68
77
|
```yaml
|
69
78
|
index_pages:
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
79
|
+
archive:
|
80
|
+
...
|
81
|
+
```
|
82
|
+
|
83
|
+
And author pages:
|
84
|
+
|
85
|
+
```yaml
|
86
|
+
index_pages:
|
87
|
+
authors:
|
88
|
+
...
|
89
|
+
```
|
90
|
+
|
91
|
+
For collection index pages, you need to include the collection name:
|
92
|
+
|
93
|
+
```yaml
|
94
|
+
index_pages:
|
95
|
+
custom_name:
|
96
|
+
collection: collection_name
|
97
|
+
...
|
98
|
+
```
|
99
|
+
|
100
|
+
Default values for each setting are:
|
101
|
+
|
102
|
+
```yaml
|
103
|
+
title: :label
|
104
|
+
excerpt: :label
|
105
|
+
per_page: 10
|
106
|
+
permalink: /:label/
|
107
|
+
layout: posts|categories|tags|authors|archive
|
88
108
|
```
|
89
109
|
|
90
110
|
For categories and tags, `:label` variable refers to the category or tag name.
|
91
|
-
For posts, `:label` will always be equal to `post`. `:label`
|
92
|
-
|
111
|
+
For posts, `:label` will always be equal to `post`. For the archive, `:label`
|
112
|
+
refers to any given year. For authors, `:label` is the author name. `:label`
|
113
|
+
value is slugified when composing the permalink.
|
114
|
+
|
115
|
+
Default value for layout depends on the type of index page. For collection
|
116
|
+
index pages, the default layout is the same as the custon name used to define the
|
117
|
+
collection config:
|
118
|
+
|
119
|
+
```yaml
|
120
|
+
custom_name:
|
121
|
+
layout: custom_name
|
122
|
+
collection: collection_name
|
123
|
+
...
|
124
|
+
```
|
93
125
|
|
94
126
|
### Including documents and pagination into templates
|
95
127
|
|
@@ -125,10 +157,24 @@ To include the pagination, you can do the following:
|
|
125
157
|
{% endif %}
|
126
158
|
```
|
127
159
|
|
160
|
+
## Development
|
161
|
+
|
162
|
+
After checking out the repo, run `script/setup` to install dependencies. Then,
|
163
|
+
run `rake spec` to run the tests. You can also run `script/console` for an
|
164
|
+
interactive prompt that will allow you to experiment.
|
165
|
+
|
166
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
167
|
+
release a new version, update the version number in `version.rb`, and then run
|
168
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
169
|
+
git commits and tags, and push the `.gem` file to
|
170
|
+
[rubygems.org](https://rubygems.org).
|
171
|
+
|
128
172
|
## Contributing
|
129
173
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
174
|
+
Bug reports and pull requests are welcome on GitHub at
|
175
|
+
https://github.com/rukbotto/jekyll-index-pages.
|
176
|
+
|
177
|
+
## License
|
178
|
+
|
179
|
+
The gem is available as open source under the terms of the [MIT
|
180
|
+
License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/jekyll-index-pages.gemspec
CHANGED
@@ -4,7 +4,6 @@ require File.expand_path("../lib/jekyll-index-pages/version", __FILE__)
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "jekyll-index-pages"
|
6
6
|
spec.version = JekyllIndexPages::VERSION
|
7
|
-
spec.date = "2017-02-21"
|
8
7
|
spec.authors = ["Jose Miguel Venegas Mendoza"]
|
9
8
|
spec.email = ["jvenegasmendoza@gmail.com"]
|
10
9
|
spec.homepage = "https://github.com/rukbotto/jekyll-index-pages"
|
@@ -13,7 +12,8 @@ Gem::Specification.new do |spec|
|
|
13
12
|
spec.summary = "Index page generator for Jekyll sites."
|
14
13
|
spec.description = <<-DESCRIPTION
|
15
14
|
Index page generator for Jekyll sites. Generates paginated index pages for
|
16
|
-
blog posts, categories and tags.
|
15
|
+
blog posts, categories and tags. It can also generate a paginated yearly
|
16
|
+
archive, author and collection pages.
|
17
17
|
DESCRIPTION
|
18
18
|
|
19
19
|
spec.files = `git ls-files`.split("\n")
|
@@ -24,5 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency("jekyll", "~> 3.3")
|
25
25
|
|
26
26
|
spec.add_development_dependency("bundler", "~> 1.14")
|
27
|
+
spec.add_development_dependency("rake", "~> 10.0")
|
27
28
|
spec.add_development_dependency("rspec", "~> 3.5")
|
28
29
|
end
|
data/lib/jekyll-index-pages.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
module JekyllIndexPages
|
2
|
+
class Archive < Jekyll::Generator
|
3
|
+
priority :high
|
4
|
+
|
5
|
+
def generate(site)
|
6
|
+
config = site.config["index_pages"] || {}
|
7
|
+
return if !config.key?("archive")
|
8
|
+
|
9
|
+
archive = Hash.new { |hash, key| hash[key] = [] }
|
10
|
+
site.posts.docs.each { |doc| archive[doc.date.strftime("%Y")] << doc }
|
11
|
+
site.data["archive"] = archive
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module JekyllIndexPages
|
2
|
+
class Author < Jekyll::Generator
|
3
|
+
priority :high
|
4
|
+
|
5
|
+
def generate(site)
|
6
|
+
config = site.config["index_pages"] || {}
|
7
|
+
return if !config.key?("authors")
|
8
|
+
|
9
|
+
authors = Hash.new { |hash, key| authors[key] = [] }
|
10
|
+
site.posts.docs.each { |doc| authors[doc.data["author"]] << doc }
|
11
|
+
site.data["authors"] = authors
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module JekyllIndexPages
|
2
|
+
class Collection < Jekyll::Generator
|
3
|
+
priority :high
|
4
|
+
|
5
|
+
def generate(site)
|
6
|
+
config = site.config["index_pages"] || {}
|
7
|
+
config.each do |kind, item|
|
8
|
+
case kind
|
9
|
+
when "posts", "categories", "tags", "archive", "authors"
|
10
|
+
next
|
11
|
+
end
|
12
|
+
next if !item.has_key?("collection")
|
13
|
+
|
14
|
+
coll_name = item["collection"]
|
15
|
+
collections = Hash.new { |hash, key| hash[key] = [] }
|
16
|
+
_, collection = site.collections.detect do |key, value|
|
17
|
+
key == coll_name
|
18
|
+
end
|
19
|
+
collection.docs.each { |doc| collections[coll_name] << doc }
|
20
|
+
site.data["collectionz"] = collections
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -8,6 +8,7 @@ module JekyllIndexPages
|
|
8
8
|
permalink = item["permalink"] || "/:label/"
|
9
9
|
per_page = item['per_page'] || 10
|
10
10
|
layout = item["layout"] || "#{kind}"
|
11
|
+
collection = item["collection"]
|
11
12
|
|
12
13
|
next if !site.layouts.key? layout
|
13
14
|
|
@@ -19,8 +20,12 @@ module JekyllIndexPages
|
|
19
20
|
site.categories
|
20
21
|
when "tags"
|
21
22
|
site.tags
|
23
|
+
when "archive"
|
24
|
+
site.data["archive"]
|
25
|
+
when "authors"
|
26
|
+
site.data["authors"]
|
22
27
|
else
|
23
|
-
|
28
|
+
site.data["collectionz"] if collection
|
24
29
|
end
|
25
30
|
|
26
31
|
doc_group.each do |label, docs|
|
data/script/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "jekyll-index-pages"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/script/setup
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe(JekyllIndexPages::Archive) do
|
4
|
+
let(:overrides) { Hash.new }
|
5
|
+
let(:site_config) do
|
6
|
+
Jekyll.configuration(Jekyll::Utils.deep_merge_hashes({
|
7
|
+
"source" => File.expand_path("../fixtures/index-page", __FILE__),
|
8
|
+
"destination" => File.expand_path("../dest", __FILE__)
|
9
|
+
}, overrides))
|
10
|
+
end
|
11
|
+
let(:site) { Jekyll::Site.new(site_config) }
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
site.process
|
15
|
+
end
|
16
|
+
|
17
|
+
context("When no configuration is provided") do
|
18
|
+
describe("Archive.generate") do
|
19
|
+
it("skips archive generation") do
|
20
|
+
expect(site.data["archive"]).to be_nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context("When default configuration for archive index pages is provided") do
|
26
|
+
let(:overrides) do
|
27
|
+
{
|
28
|
+
"index_pages" => {
|
29
|
+
"archive" => {}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
describe("Archive.generate") do
|
35
|
+
it("generates a five year post archive") do
|
36
|
+
expect(site.data["archive"].length).to eq(5)
|
37
|
+
end
|
38
|
+
|
39
|
+
it("each year containing only one post") do
|
40
|
+
expect(site.data["archive"]["1966"].length).to eq(1)
|
41
|
+
expect(site.data["archive"]["1987"].length).to eq(1)
|
42
|
+
expect(site.data["archive"]["1993"].length).to eq(1)
|
43
|
+
expect(site.data["archive"]["1995"].length).to eq(1)
|
44
|
+
expect(site.data["archive"]["2001"].length).to eq(1)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/author_spec.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe(JekyllIndexPages::Author) do
|
4
|
+
let(:overrides) { Hash.new }
|
5
|
+
let(:site_config) do
|
6
|
+
Jekyll.configuration(Jekyll::Utils.deep_merge_hashes({
|
7
|
+
"source" => File.expand_path("../fixtures/index-page", __FILE__),
|
8
|
+
"destination" => File.expand_path("../dest", __FILE__)
|
9
|
+
}, overrides))
|
10
|
+
end
|
11
|
+
let(:site) { Jekyll::Site.new(site_config) }
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
site.process
|
15
|
+
end
|
16
|
+
|
17
|
+
context("When no configuration is provided") do
|
18
|
+
describe("Author.generate") do
|
19
|
+
it("skips author index page generation") do
|
20
|
+
expect(site.data["author"]).to be_nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context("When default configuration is provided") do
|
26
|
+
let(:overrides) do
|
27
|
+
{
|
28
|
+
"index_pages" => {
|
29
|
+
"authors" => {}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
describe("Author.generate") do
|
35
|
+
it("generates five author index pages") do
|
36
|
+
expect(site.data["authors"].length).to eq(5)
|
37
|
+
end
|
38
|
+
|
39
|
+
it("each page containing only one post") do
|
40
|
+
expect(site.data["authors"]["James T Kirk"].length).to eq(1)
|
41
|
+
expect(site.data["authors"]["Jean-Luc Picard"].length).to eq(1)
|
42
|
+
expect(site.data["authors"]["Benjamin Sisko"].length).to eq(1)
|
43
|
+
expect(site.data["authors"]["Kathryn Janeway"].length).to eq(1)
|
44
|
+
expect(site.data["authors"]["Jonathan Archer"].length).to eq(1)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe(JekyllIndexPages::Collection) do
|
4
|
+
let(:overrides) { Hash.new }
|
5
|
+
let(:site_config) do
|
6
|
+
Jekyll.configuration(Jekyll::Utils.deep_merge_hashes({
|
7
|
+
"source" => File.expand_path("../fixtures/index-page", __FILE__),
|
8
|
+
"destination" => File.expand_path("../dest", __FILE__)
|
9
|
+
}, overrides))
|
10
|
+
end
|
11
|
+
let(:site) { Jekyll::Site.new(site_config) }
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
site.process
|
15
|
+
end
|
16
|
+
|
17
|
+
context("When no configuration is provided") do
|
18
|
+
describe("Collection.generate") do
|
19
|
+
it("skips collection index pages generation") do
|
20
|
+
expect(site.data["collectionz"]).to be_nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context("When default configuration is provided") do
|
26
|
+
let(:overrides) do
|
27
|
+
{
|
28
|
+
"collections" => ["starships"],
|
29
|
+
"index_pages" => {
|
30
|
+
"custom" => {
|
31
|
+
"collection" => "starships"
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
describe("Collection.generate") do
|
38
|
+
it("generates a single index page for collection") do
|
39
|
+
expect(site.data["collectionz"].length).to eq(1)
|
40
|
+
end
|
41
|
+
|
42
|
+
it("containing four documents") do
|
43
|
+
expect(site.data["collectionz"]["starships"].length).to eq(4)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>{{ page.title }}</title>
|
6
|
+
<meta name="description" content="{{ page.excerpt | strip_html }}">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
{% assign pager = page.pager %}
|
10
|
+
|
11
|
+
<h1>{{ page.title }}</h1>
|
12
|
+
|
13
|
+
{% for doc in pager.docs %}
|
14
|
+
<h2>{{ doc.title }}</h2>
|
15
|
+
{% endfor%}
|
16
|
+
|
17
|
+
{% if pager.total_pages > 1 %}
|
18
|
+
{% if pager.prev_page > 0 %}
|
19
|
+
<a href="{{ pager.prev_page_url }}">Prev. page</a>
|
20
|
+
{% endif %}
|
21
|
+
<span>Page {{ pager.current_page }} of {{ pager.total_pages }}</span>
|
22
|
+
{% if pager.next_page > 0 %}
|
23
|
+
<a href="{{ pager.next_page_url }}">Next page</a>
|
24
|
+
{% endif %}
|
25
|
+
{% endif %}
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
---
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>{{ page.title }}</title>
|
6
|
+
<meta name="description" content="{{ page.excerpt | strip_html }}">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
{% assign pager = page.pager %}
|
10
|
+
|
11
|
+
<h1>{{ page.title }}</h1>
|
12
|
+
|
13
|
+
{% for doc in pager.docs %}
|
14
|
+
<h2>{{ doc.title }}</h2>
|
15
|
+
{% endfor%}
|
16
|
+
|
17
|
+
{% if pager.total_pages > 1 %}
|
18
|
+
{% if pager.prev_page > 0 %}
|
19
|
+
<a href="{{ pager.prev_page_url }}">Prev. page</a>
|
20
|
+
{% endif %}
|
21
|
+
<span>Page {{ pager.current_page }} of {{ pager.total_pages }}</span>
|
22
|
+
{% if pager.next_page > 0 %}
|
23
|
+
<a href="{{ pager.next_page_url }}">Next page</a>
|
24
|
+
{% endif %}
|
25
|
+
{% endif %}
|
26
|
+
</body>
|
27
|
+
</html>
|
data/spec/generator_spec.rb
CHANGED
@@ -163,7 +163,7 @@ describe(JekyllIndexPages::Generator) do
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
-
context("When default
|
166
|
+
context("When default configuration for category index pages is provided") do
|
167
167
|
let(:overrides) do
|
168
168
|
{
|
169
169
|
"index_pages" => {
|
@@ -183,7 +183,7 @@ describe(JekyllIndexPages::Generator) do
|
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
186
|
-
context("When default
|
186
|
+
context("When default configuration for tag index pages is provided") do
|
187
187
|
let(:overrides) do
|
188
188
|
{
|
189
189
|
"index_pages" => {
|
@@ -202,4 +202,68 @@ describe(JekyllIndexPages::Generator) do
|
|
202
202
|
end
|
203
203
|
end
|
204
204
|
end
|
205
|
+
|
206
|
+
context("When default configuration for archive index pages is provided") do
|
207
|
+
let(:overrides) do
|
208
|
+
{
|
209
|
+
"index_pages" => {
|
210
|
+
"archive" => {}
|
211
|
+
}
|
212
|
+
}
|
213
|
+
end
|
214
|
+
|
215
|
+
describe("Generator.generate") do
|
216
|
+
it("generates five archive index pages") do
|
217
|
+
expect(site.pages.length).to eq(5)
|
218
|
+
end
|
219
|
+
|
220
|
+
it("generates the first archive index page at /1966/") do
|
221
|
+
expect(site.pages[0].url).to eq("/1966/")
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
context("When default configuration for author index pages is provided") do
|
227
|
+
let(:overrides) do
|
228
|
+
{
|
229
|
+
"index_pages" => {
|
230
|
+
"authors" => {}
|
231
|
+
}
|
232
|
+
}
|
233
|
+
end
|
234
|
+
|
235
|
+
describe("Generator.generate") do
|
236
|
+
it("generates five author index pages") do
|
237
|
+
expect(site.pages.length).to eq(5)
|
238
|
+
end
|
239
|
+
|
240
|
+
it("generates the first author index page at /james-t-kirk/") do
|
241
|
+
expect(site.pages[0].url).to eq("/james-t-kirk/")
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
context("When default configuration for collection index pages is provided") do
|
247
|
+
let(:overrides) do
|
248
|
+
{
|
249
|
+
"collections" => ["starships"],
|
250
|
+
"index_pages" => {
|
251
|
+
"custom" => {
|
252
|
+
"layout" => "custom-layout",
|
253
|
+
"collection" => "starships"
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}
|
257
|
+
end
|
258
|
+
|
259
|
+
describe("Generator.generate") do
|
260
|
+
it("generates a single collection index page") do
|
261
|
+
expect(site.pages.length).to eq(1)
|
262
|
+
end
|
263
|
+
|
264
|
+
it("generates the first collection index page at /starships/") do
|
265
|
+
expect(site.pages[0].url).to eq("/starships/")
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
205
269
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-index-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Miguel Venegas Mendoza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,7 +68,8 @@ dependencies:
|
|
54
68
|
version: '3.5'
|
55
69
|
description: |2
|
56
70
|
Index page generator for Jekyll sites. Generates paginated index pages for
|
57
|
-
blog posts, categories and tags.
|
71
|
+
blog posts, categories and tags. It can also generate a paginated yearly
|
72
|
+
archive, author and collection pages.
|
58
73
|
email:
|
59
74
|
- jvenegasmendoza@gmail.com
|
60
75
|
executables: []
|
@@ -63,16 +78,28 @@ extra_rdoc_files: []
|
|
63
78
|
files:
|
64
79
|
- ".gitignore"
|
65
80
|
- ".rspec"
|
81
|
+
- ".travis.yml"
|
66
82
|
- Gemfile
|
67
83
|
- LICENSE.md
|
68
84
|
- README.md
|
85
|
+
- Rakefile
|
69
86
|
- jekyll-index-pages.gemspec
|
70
87
|
- lib/jekyll-index-pages.rb
|
88
|
+
- lib/jekyll-index-pages/archive.rb
|
89
|
+
- lib/jekyll-index-pages/author.rb
|
90
|
+
- lib/jekyll-index-pages/collection.rb
|
71
91
|
- lib/jekyll-index-pages/generator.rb
|
72
92
|
- lib/jekyll-index-pages/index-page.rb
|
73
93
|
- lib/jekyll-index-pages/pagination.rb
|
74
94
|
- lib/jekyll-index-pages/version.rb
|
95
|
+
- script/console
|
96
|
+
- script/setup
|
97
|
+
- spec/archive_spec.rb
|
98
|
+
- spec/author_spec.rb
|
99
|
+
- spec/collection_spec.rb
|
75
100
|
- spec/fixtures/index-page/_config.yml
|
101
|
+
- spec/fixtures/index-page/_layouts/archive.html
|
102
|
+
- spec/fixtures/index-page/_layouts/authors.html
|
76
103
|
- spec/fixtures/index-page/_layouts/categories.html
|
77
104
|
- spec/fixtures/index-page/_layouts/custom-layout.html
|
78
105
|
- spec/fixtures/index-page/_layouts/default.html
|
@@ -83,6 +110,10 @@ files:
|
|
83
110
|
- spec/fixtures/index-page/_posts/1993-01-03-star-trek-deep-space-nine.md
|
84
111
|
- spec/fixtures/index-page/_posts/1995-01-16-star-trek-voyager.md
|
85
112
|
- spec/fixtures/index-page/_posts/2001-09-26-star-trek-enterprise.md
|
113
|
+
- spec/fixtures/index-page/_starships/deep-space-nine.md
|
114
|
+
- spec/fixtures/index-page/_starships/enterprise-d.md
|
115
|
+
- spec/fixtures/index-page/_starships/enterprise.md
|
116
|
+
- spec/fixtures/index-page/_starships/voyager.md
|
86
117
|
- spec/generator_spec.rb
|
87
118
|
- spec/index-page_spec.rb
|
88
119
|
- spec/pagination_spec.rb
|
@@ -112,7 +143,12 @@ signing_key:
|
|
112
143
|
specification_version: 4
|
113
144
|
summary: Index page generator for Jekyll sites.
|
114
145
|
test_files:
|
146
|
+
- spec/archive_spec.rb
|
147
|
+
- spec/author_spec.rb
|
148
|
+
- spec/collection_spec.rb
|
115
149
|
- spec/fixtures/index-page/_config.yml
|
150
|
+
- spec/fixtures/index-page/_layouts/archive.html
|
151
|
+
- spec/fixtures/index-page/_layouts/authors.html
|
116
152
|
- spec/fixtures/index-page/_layouts/categories.html
|
117
153
|
- spec/fixtures/index-page/_layouts/custom-layout.html
|
118
154
|
- spec/fixtures/index-page/_layouts/default.html
|
@@ -123,6 +159,10 @@ test_files:
|
|
123
159
|
- spec/fixtures/index-page/_posts/1993-01-03-star-trek-deep-space-nine.md
|
124
160
|
- spec/fixtures/index-page/_posts/1995-01-16-star-trek-voyager.md
|
125
161
|
- spec/fixtures/index-page/_posts/2001-09-26-star-trek-enterprise.md
|
162
|
+
- spec/fixtures/index-page/_starships/deep-space-nine.md
|
163
|
+
- spec/fixtures/index-page/_starships/enterprise-d.md
|
164
|
+
- spec/fixtures/index-page/_starships/enterprise.md
|
165
|
+
- spec/fixtures/index-page/_starships/voyager.md
|
126
166
|
- spec/generator_spec.rb
|
127
167
|
- spec/index-page_spec.rb
|
128
168
|
- spec/pagination_spec.rb
|