Class: Zenweb::YearlyPage

Inherits:
GeneratedIndex show all
Defined in:
lib/zenweb/page.rb

Overview

Generates a virtual page with yearly index pages. You must subclass and provide a content method.

Constant Summary

Constants inherited from Page

Page::KRAMDOWN_CONFIG

Instance Attribute Summary

Attributes inherited from GeneratedIndex

#pages

Attributes inherited from FakePage

#content, #date

Attributes inherited from Page

#binary, #parent, #path, #site, #subpages

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GeneratedIndex

collate_by, #content, page_url, #wire

Methods inherited from Page

#[], #all_subpages, #all_subpages_by_level, #analytics, #body, #breadcrumbs, #change_frequency, #clean_url, #config, #content, #date, #date_from_path, #date_str, #dated?, #dated_path?, #depends_on, #disqus, #disqus_counts, #erb, #extend_md, #filetype, #filetypes, #format_date, #gauges_analytics, #generate, #google_ad, #google_analytics, #html?, #include, #index?, #inspect, #layout, #link_head, #link_html, #markdown, #meta, #method_missing, #no_index?, #parent_url, #render, #render_erb, #render_less, #render_md, renderers_re, #run_js_script, #series_page, #stale?, #stylesheet, #subrender, #tag_pages, #url, #url_dir, #url_path, #wire

Constructor Details

#initialize(site, path, pages, year) ⇒ YearlyPage

Returns a new instance of YearlyPage.



660
661
662
663
664
# File 'lib/zenweb/page.rb', line 660

def initialize site, path, pages, year
  super site, path, pages
  self.date = Time.local(year)
  config.h['date'] = self.date
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Zenweb::Page

Class Method Details

.generate_all(site, dir, pages) ⇒ Object



651
652
653
654
655
656
657
658
# File 'lib/zenweb/page.rb', line 651

def self.generate_all site, dir, pages
  pages.find_all(&:dated?).group_by { |page|
    page.date.year
  }.each do |year, subpages|
    path = "#{dir}/%4d/index.html.md.erb" % [year]
    self.new site, path, subpages, year
  end
end