Class: JekyllPagesApiSearch::SearchPageLayouts
- Inherits:
-
Jekyll::Layout
- Object
- Jekyll::Layout
- JekyllPagesApiSearch::SearchPageLayouts
- Defined in:
- lib/jekyll_pages_api_search/search_page_layouts.rb
Overview
We have to essentially recreate the ::Jekyll::Layout constructor to loosen the default restriction that layouts be included in the site source.
Copied from guides_style_18f/layouts.rb. Could probably be extracted into another gem.
Constant Summary collapse
- DEFAULT_LAYOUT =
'search-results'- LAYOUTS_DIR =
File.join(File.dirname(__FILE__), 'layouts')
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(site, layout_name) ⇒ SearchPageLayouts
constructor
A new instance of SearchPageLayouts.
Constructor Details
#initialize(site, layout_name) ⇒ SearchPageLayouts
Returns a new instance of SearchPageLayouts.
16 17 18 19 20 21 22 23 24 |
# File 'lib/jekyll_pages_api_search/search_page_layouts.rb', line 16 def initialize(site, layout_name) @site = site @base = LAYOUTS_DIR @name = "#{layout_name}.html" @path = File.join(@base, @name) @relative_path = @path.sub(@base, '') parse_content_and_data(File.join(@base, name)) process(name) end |
Class Method Details
.register(site) ⇒ Object
39 40 41 |
# File 'lib/jekyll_pages_api_search/search_page_layouts.rb', line 39 def self.register(site) site.layouts[DEFAULT_LAYOUT] ||= new(site, DEFAULT_LAYOUT) end |