Pass items from parameter to generated page
This commit is contained in:
parent
5dd85b2777
commit
a18e920e2b
3 changed files with 6 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<%= render 'pager', :linkprev => @linkprev, :linknext => @linknext %>
|
||||
<div class="row">
|
||||
<% latest_articles.select { |a| a[:created_at].year == @year }.each do |item| %>
|
||||
<% @item[:archiveitems].each do |item| %>
|
||||
<div class="span8">
|
||||
<%= render 'item_intro', :item => item, :extended => true %>
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
require 'ostruct'
|
||||
|
||||
def generate_archive_pages()
|
||||
articles = items.select { |i| i[:kind] == 'article' }
|
||||
generate_yearly_archive(articles, '/archives/articles', 'Blogarchiv')
|
||||
generate_yearly_archive(articles, :created_at, '/archives/articles', 'Blogarchiv')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
require 'ostruct'
|
||||
|
||||
def generate_yearly_archive(articles, basepath, title, templatename = 'article_archive')
|
||||
yearmap = articles.group_by { |item| item[:created_at].year }
|
||||
def generate_yearly_archive(articles, date_attribute, basepath, title, templatename = 'article_archive')
|
||||
yearmap = articles.group_by { |item| item[date_attribute].year }
|
||||
yearlist = yearmap.keys.sort
|
||||
yearlist.each_index { |i|
|
||||
year = yearlist[i]
|
||||
|
|
@ -16,8 +16,8 @@ def generate_yearly_archive(articles, basepath, title, templatename = 'article_a
|
|||
""
|
||||
end
|
||||
@items << Nanoc::Item.new(
|
||||
"<%= render '#{templatename}', :year => #{year} #{linkprev} #{linknext} %>",
|
||||
{ :title => "#{title} #{year}", :kind => "fullpage" },
|
||||
"<%= render '#{templatename}' #{linkprev} #{linknext} %>",
|
||||
{ :title => "#{title} #{year}", :kind => "fullpage", :archiveitems => yearmap[year] },
|
||||
"#{basepath}/#{year}/")
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue