Class: Zenweb::MonthlyPage

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

Overview

Generates a virtual page with monthly 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, month) ⇒ MonthlyPage

Returns a new instance of MonthlyPage.



639
640
641
642
643
# File 'lib/zenweb/page.rb', line 639

def initialize site, path, pages, year, month
  super site, path, pages
  self.date = Time.local(year, month)
  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



630
631
632
633
634
635
636
637
# File 'lib/zenweb/page.rb', line 630

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