Module: Jekyll::ThemeLayout

Defined in:
lib/jekyll/theme_layout.rb

Overview

Resolves the layout file that PagedFeedPage and PodcastPlayerPage read directly (instead of going through a page's normal 'layout:' front matter, which Jekyll::LayoutReader already resolves site-then-theme on its own). Mirrors Jekyll::Layout#initialize's own precedence (see jekyll/layout.rb in the jekyll gem): prefer the site's own '_layouts/', fall back to the active theme's. Needed since jekyll-octopod-bulma (0.18.0+) ships 'feed.xml'/'player_index.html' as theme content instead of every site getting its own copy via 'octopod setup'/'update'.

Class Method Summary collapse

Class Method Details

.path_for(site, base, filename) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/jekyll/theme_layout.rb', line 9

def self.path_for(site, base, filename)
  if File.exist?(File.join(base, '_layouts', filename))
    site.in_source_dir(base, '_layouts', filename)
  elsif site.theme&.layouts_path
    site.in_theme_dir(site.theme.layouts_path, filename)
  else
    site.in_source_dir(base, '_layouts', filename)
  end
end