Class: SemiStatic::Index

Inherits:
Base
  • Object
show all
Includes:
Convertable
Defined in:
lib/semi-static/index.rb

Overview

Index is used to generate several site index pages that don’t have a fixed path (i.e., the yearly index pages) from a single source file. It can have a Layout and use any number of Snippets. Index’s modification time is the most recent of itself, its layout, and any Snippets used. Indices are also considered out-of-date if any posts in the index’s range are changed.

Instance Attribute Summary collapse

Attributes inherited from Base

#full_source_path, #site, #source_content, #source_ext, #source_metadata, #source_path

Instance Method Summary collapse

Methods included from Convertable

#content, #layout, #layout_name, #load, #object_ref, #render, #snippet, #source_mtime, #underscore

Methods inherited from Base

#source_mtime

Constructor Details

#initialize(site, path) ⇒ Index

Initializes a new Index

site

The Site object we belong to

path

The relative path to the source file



25
26
27
28
# File 'lib/semi-static/index.rb', line 25

def initialize(site, path)
    super
    @metadata = [ :layout ]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SemiStatic::Base

Instance Attribute Details

#contextObject

The Index’s current context (usually a Date).



18
19
20
# File 'lib/semi-static/index.rb', line 18

def context
  @context
end

#postsObject

Posts in range for the Index’s current path.



14
15
16
# File 'lib/semi-static/index.rb', line 14

def posts
  @posts
end