diff --git a/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb b/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb index 1ea942567..0408211ea 100644 --- a/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb +++ b/lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb @@ -5,7 +5,7 @@ <% sidebar.archives.each do |month| %> <% counter = sidebar.show_count ? "(#{month[:article_count]})" : "" %>
  • - <%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]+1) ) %> + <%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]) ) %>
  • <% end %> diff --git a/lib/archives_sidebar/lib/archives_sidebar.rb b/lib/archives_sidebar/lib/archives_sidebar.rb index b77559ca6..50f789503 100644 --- a/lib/archives_sidebar/lib/archives_sidebar.rb +++ b/lib/archives_sidebar/lib/archives_sidebar.rb @@ -30,11 +30,11 @@ def parse_request(_contents, _params) article_counts = Content.find_by_sql(["select count(*) as count, #{date_func} from contents where type='Article' and published = ? and published_at < ? group by year,month order by year desc,month desc limit ? ", true, Time.now, count.to_i]) @archives = article_counts.map do |entry| - month = (entry.month.to_i%12)+1 + month = (entry.month.to_i%12) year = entry.year.to_i { name: I18n.l(Date.new(year, month), format: '%B %Y'), - month: month - 1, + month: month -1, year: year, article_count: entry.count }