使用 nanoc 创建博客存档页面,我想显示一个类似于http://daringfireball.net/archive/中显示的列表
根据 nanoc 中博客文章的过时方式,我遇到了问题。这是我尝试过的代码:
by_yearmonth = @site.sorted_articles.group_by{ |a| [a.date.year,a.date.month] }
by_yearmonth.keys.sort.each do |yearmonth|
articles_this_month = by_yearmonth[yearmonth]
# code here to display month and year
articles_this_month.each do |article|
# code here to display title of blog post
end
end
nanoc 似乎不理解 a.date.year 或 a.date.month ——当我尝试编译该站点时,我收到一条错误消息,指出“日期”方法未定义。