Skip to content

Commit 8bc0805

Browse files
committed
Made month_names an ivar.
1 parent 8c15857 commit 8bc0805

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

_plugins/news.rb

+5-9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def initialize(site,base,layout,lang,posts)
1515
@locales = @site.config['locales']['news'][@lang] ||
1616
@site.config['locales']['news']['en']
1717

18+
@month_names = @site.config['locales']['month_names'][@lang] ||
19+
@site.config['locales']['month_names']['en']
20+
1821
process(@name)
1922
read_yaml(File.join(base, '_layouts'),layout)
2023

@@ -30,13 +33,6 @@ def news_dir
3033
end
3134
end
3235

33-
def month_names
34-
month_names = @site.config['locales']['month_names'][@lang]
35-
month_names ||= @site.config['locales']['month_names']['en']
36-
37-
['None'] + month_names
38-
end
39-
4036
end
4137

4238
class MonthlyArchive < ArchivePage
@@ -55,7 +51,7 @@ def initialize(site,base,lang,year,month,posts)
5551
data['title'] = title.gsub(/%Y|%m|%B/, {
5652
'%Y' => @year.to_s,
5753
'%m' => "%.2d" % @month,
58-
'%B' => month_names[@month]
54+
'%B' => @month_names[@month]
5955
})
6056
data['year'] = year
6157
end
@@ -86,7 +82,7 @@ def initialize(site,base,lang,year,posts)
8682
months.map { |month| month_link_text.gsub(/%Y|%m|%B/, {
8783
'%Y' => @year.to_s,
8884
'%m' => "%.2d" % month,
89-
'%B' => month_names[month]
85+
'%B' => @month_names[month]
9086
})
9187
}
9288
)

0 commit comments

Comments
 (0)