jekyll-auto-authors 1.0.1 → 1.0.3
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/lib/jekyll-auto-authors/defaults.rb +3 -1
- data/lib/jekyll-auto-authors/main.rb +32 -3
- data/lib/jekyll-auto-authors/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 619f12ab13a88c692e32371bb389bc9f442391b9aea36e4d83c104ce844d48b3
|
4
|
+
data.tar.gz: e1d98c0166bc1dd870dc75601380235e2f466a2aa21c89899fb239f6d8030be7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ad6e73fbdefaebff2b39fe8da2f42984ca20f44611b21a7aae2faa0f53700c4358c19dca80ed11c0315b41ff8762f2824e7174fe52a8a513e8baa27c89c71a7
|
7
|
+
data.tar.gz: d771e0728d02b0051f61c44e1fb6cc17b1e53a940010b54027832ee60174c9f8be2404a462b323bbf05cb36012b7ed46d2af30894e5e44766544214c67b83604
|
@@ -8,8 +8,10 @@ module Jekyll
|
|
8
8
|
"data" => "_data/authors.yml", # The data file inside _data/ folder that contains author information.
|
9
9
|
"layouts" => ["authors.html"], # The layout file inside _layouts/ folder to use for the author pages.
|
10
10
|
|
11
|
+
"exclude" => [], # The list of authors to **force** skip processing an autopage for.
|
12
|
+
|
11
13
|
"title" => "Posts by :author", # :author is replaced by author name.
|
12
|
-
"permalink" => "/author/:author", # :author is customizable elements
|
14
|
+
"permalink" => "/author/:author", # :author is customizable elements.
|
13
15
|
|
14
16
|
"slugify" => {
|
15
17
|
"mode" => "none", # [raw, default, pretty, ascii or latin], none gives back the same string.
|
@@ -26,11 +26,12 @@ module Jekyll
|
|
26
26
|
return
|
27
27
|
end
|
28
28
|
|
29
|
-
Jekyll.logger.info "Author Pages:", "Generating..."
|
30
|
-
|
31
29
|
# Lambda that created the author page for a given author.
|
32
30
|
# will be passed to PaginateV2::Autopages for processing.
|
33
31
|
createauthorpage_lambda = lambda do | autopage_author_config, pagination_config, layout_name, author, author_original_name |
|
32
|
+
# Force skip excluded authors from autopage generation
|
33
|
+
return if autopage_author_config["exclude"].include?(author)
|
34
|
+
|
34
35
|
if !autopage_author_config["data"].nil?
|
35
36
|
author_data = YAML::load(File.read(autopage_author_config["data"]))[author_original_name]
|
36
37
|
|
@@ -59,6 +60,32 @@ module Jekyll
|
|
59
60
|
autopage_config, pagination_config, posts_to_use, "authors", "author", createauthorpage_lambda
|
60
61
|
)
|
61
62
|
|
63
|
+
# Set of authors for whom autopages have been created
|
64
|
+
finished_pages = Set.new
|
65
|
+
|
66
|
+
posts_to_use.each do | post |
|
67
|
+
next if post.data["author"].nil? || finished_pages.include?(post.data["author"])
|
68
|
+
finished_pages << post.data["author"]
|
69
|
+
end
|
70
|
+
|
71
|
+
if !authors_config["data"].nil?
|
72
|
+
# if a data file containing authors is not nil, then iterate through the specified
|
73
|
+
# authors to build author pages for them, even if they don't have posts yet.
|
74
|
+
author_data = YAML::load(File.read(authors_config["data"]))
|
75
|
+
|
76
|
+
author_data.each do | author, data |
|
77
|
+
# The exclude attribute ignores authors from autopage generation unless they have a post assigned.
|
78
|
+
if !finished_pages.include?(author) and !data["exclude"]
|
79
|
+
# create pages for pending authors with specified layouts
|
80
|
+
authors_config['layouts'].each do | layout_name |
|
81
|
+
createauthorpage_lambda.call(authors_config, pagination_config, layout_name, author, author)
|
82
|
+
end
|
83
|
+
|
84
|
+
finished_pages << author
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
62
89
|
# Now auto pages for authors have been created, we can generate the pagination logic.
|
63
90
|
|
64
91
|
# Further logic is mostly similar as PaginateV2::Generator::PaginationModel#paginate(), but we need
|
@@ -133,7 +160,8 @@ module Jekyll
|
|
133
160
|
|
134
161
|
pagination_posts.sort!{ |a,b|
|
135
162
|
PaginateV2::Generator::Utils.sort_values(
|
136
|
-
PaginateV2::Generator::Utils.sort_get_post_data(a.data, sort_field),
|
163
|
+
PaginateV2::Generator::Utils.sort_get_post_data(a.data, sort_field),
|
164
|
+
PaginateV2::Generator::Utils.sort_get_post_data(b.data, sort_field)
|
137
165
|
)
|
138
166
|
}
|
139
167
|
|
@@ -256,6 +284,7 @@ module Jekyll
|
|
256
284
|
end
|
257
285
|
end
|
258
286
|
|
287
|
+
Jekyll.logger.info "Author Pages:", "Generated autopages for #{finished_pages.size} author(s)"
|
259
288
|
end
|
260
289
|
end
|
261
290
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-auto-authors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gourav Khunger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
rubygems_version: 3.3.
|
91
|
+
rubygems_version: 3.3.11
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Seamless multiple authors support for jekyll powered publications
|