Skip to content

Commit 4c2a9fc

Browse files
committed
🤪
1 parent 43935c0 commit 4c2a9fc

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

lib/jekyll-archives.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,46 +41,46 @@ def generate(site)
4141
end
4242

4343
def enabled?(archive)
44-
@config['enabled'] == true || @config['enabled'] == 'all' ||
45-
(@config['enabled'].is_a?(Array) && @config['enabled'].include?(archive))
44+
@config["enabled"] == true || @config["enabled"] == "all" ||
45+
(@config["enabled"].is_a?(Array) && @config["enabled"].include?(archive))
4646
end
4747

4848
# Read archive data from posts
4949
def read
50-
read_tags if enabled?('tags')
51-
read_categories if enabled?('categories')
52-
read_posts_per_year if enabled?('year')
53-
read_posts_per_month if enabled?('month')
54-
read_posts_per_day if enabled?('day')
50+
read_tags if enabled?("tags")
51+
read_categories if enabled?("categories")
52+
read_posts_per_year if enabled?("year")
53+
read_posts_per_month if enabled?("month")
54+
read_posts_per_day if enabled?("day")
5555
end
5656

5757
def read_tags
58-
@archives += @site.post_attr_hash('tags').map do |title, posts|
59-
Archive.new(@site, title, 'tag', posts)
58+
@archives += @site.post_attr_hash("tags").map do |title, posts|
59+
Archive.new(@site, title, "tag", posts)
6060
end
6161
end
6262

6363
def read_categories
64-
@archives += @site.post_attr_hash('categories').map do |title, posts|
65-
Archive.new(@site, title, 'category', posts)
64+
@archives += @site.post_attr_hash("categories").map do |title, posts|
65+
Archive.new(@site, title, "category", posts)
6666
end
6767
end
6868

6969
def read_posts_per_year
7070
@archives += @posts.docs.group_by { |p| p.date.year }.map do |year, posts_for_year|
71-
Archive.new(@site, { :year => year }, 'year', posts_for_year.sort.reverse)
71+
Archive.new(@site, { :year => year }, "year", posts_for_year.sort.reverse)
7272
end
7373
end
7474

7575
def read_posts_per_month
7676
@archives += @posts.docs.group_by { |p| [p.date.year, p.date.month] }.map do |(year, month), posts_for_month|
77-
Archive.new(@site, { :year => year, :month => month }, 'month', posts_for_month.sort.reverse)
77+
Archive.new(@site, { :year => year, :month => month }, "month", posts_for_month.sort.reverse)
7878
end
7979
end
8080

8181
def read_posts_per_day
8282
@archives += @posts.docs.group_by { |p| [p.date.year, p.date.month, p.date.day] }.map do |(year, month, day), posts_for_day|
83-
Archive.new(@site, { :year => year, :month => month, :day => day }, 'day', posts_for_day.sort.reverse)
83+
Archive.new(@site, { :year => year, :month => month, :day => day }, "day", posts_for_day.sort.reverse)
8484
end
8585
end
8686
end

lib/jekyll-archives/archive.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def layout
6969
def url_placeholders
7070
if @title.is_a? Hash
7171
{
72-
:year => @title[:year].to_s,
73-
:month => @title[:month].to_s.rjust(2, '0'),
74-
:day => @title[:day].to_s.rjust(2, '0'),
75-
:type => @type
72+
:year => @title[:year].to_s,
73+
:month => @title[:month].to_s.rjust(2, "0"),
74+
:day => @title[:day].to_s.rjust(2, "0"),
75+
:type => @type
7676
}
7777
else
7878
{ :name => @slug, :type => @type }

0 commit comments

Comments
 (0)