module Orthor class Site class << self include Orthor::Collections include Orthor::HttpCaching include Orthor::MetaData dsl_accessor :layout attr_accessor :current_template def define(&blk) @feeds, @categories, @pages, @static_pages, @queries = [], [], [], [], [] layout(:orthor_layout) cache_for 0 keywords "" description "" class_eval &blk end def with_template(name, &blk) raise ArgumentError, "block required" unless block_given? @current_template = name class_eval &blk @current_template = nil end def find_resource_by_path(path) Orthor::Site.resources.detect { |r| r.path == path } end def find_resource_by_page_path(path, id) Orthor::Site.resources.detect { |r| r.is_a?(Orthor::Category) && r.page_path.gsub(":id", id) == path } end end end end