diff --git a/Rules b/Rules
index 4bc80dd8..ebfb1f64 100644
--- a/Rules
+++ b/Rules
@@ -1,8 +1,7 @@
#!/usr/bin/env ruby
preprocess do
- #generate_archive_pages
- #generate_tag_pages
+ generate_archive_pages
generate_twitter_archive_pages
end
diff --git a/content/htaccess.txt b/content/htaccess.txt
index 85fda2ad..c2e49fcc 100644
--- a/content/htaccess.txt
+++ b/content/htaccess.txt
@@ -1,4 +1,5 @@
ErrorDocument 404 /404/index.html
+RedirectMatch 301 ^/archives/articles/$ /archives/articles/<%= latest_articles(1)[0][:created_at].year %>/
RedirectMatch 301 ^/archives/twitter/$ /archives/twitter/<%= twitter_grouped_by_month.keys.sort.last %>/
diff --git a/layouts/article_archive.erb b/layouts/article_archive.erb
new file mode 100644
index 00000000..d9970f46
--- /dev/null
+++ b/layouts/article_archive.erb
@@ -0,0 +1,11 @@
+<%= render 'pager', :linkprev => @linkprev, :linknext => @linknext %>
+
+ <% latest_articles.select { |a| a[:created_at].year == @year }.each do |item| %>
+
+ <%= render 'article_intro', :article => item, :extended => true %>
+
+ Zum Artikel
+
+ <% end %>
+
+<%= render 'pager', :linkprev => @linkprev, :linknext => @linknext %>
diff --git a/lib/articlearchive.rb b/lib/articlearchive.rb
new file mode 100644
index 00000000..839cec97
--- /dev/null
+++ b/lib/articlearchive.rb
@@ -0,0 +1,29 @@
+require 'ostruct'
+
+def generate_archive_pages()
+# articles = items.select { |i| i[:kind] == 'article' }.
+# sort { |a,b| b[:created_at] <=> a[:created_at] }
+# articles = sorted_articles
+ articles = items.select { |i| i[:kind] == 'article' }
+ yearmap = articles.group_by { |item| item[:created_at].year }
+# yearmap.keys.sort.each { |year|
+# puts "#{year} --> #{yearmap[year]}"
+# }
+ yearmap.keys.each { |year|
+ # Simplified assumption: At least one blog post each year
+ linkprev = if (year>yearmap.keys.min)
+ ", :linkprev => OpenStruct.new(:title => #{year-1}, :link => '/archives/articles/#{year-1}/')"
+ else
+ ""
+ end
+ linknext = if (year OpenStruct.new(:title => #{year+1}, :link => '/archives/articles/#{year+1}/')"
+ else
+ ""
+ end
+ @items << Nanoc::Item.new(
+ "<%= render 'article_archive', :year => #{year} #{linkprev} #{linknext} %>",
+ { :title => "Blogarchiv #{year}", :kind => "fullpage" },
+ "/archives/articles/#{year}/")
+ }
+end