class Awestruct::Extensions::Indexifier

Public Class Methods

new(exclude_regex_paths = []) click to toggle source
# File lib/awestruct/extensions/indexifier.rb, line 5
def initialize(exclude_regex_paths = [])
  @exclude_regex_paths = exclude_regex_paths
  @exclude_regex_paths << /^(.*\/)?index.html$/
end

Public Instance Methods

execute(site) click to toggle source
# File lib/awestruct/extensions/indexifier.rb, line 10
def execute(site)
  site.pages.each do |page|
    if ( page.inhibit_indexifier ||  Regexp.union(@exclude_regex_paths).match(page.output_path) )
      # skip it!
    else
      page.output_path = page.output_path.gsub( /.html$/, '/index.html' )
    end
  end
end