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 を理解していないようです -- サイトをコンパイルしようとすると、「date」メソッドが定義されていないというエラーが表示されます。