Class: Jekyll::DirectoryListingPage
- Inherits:
-
Page
- Object
- Page
- Jekyll::DirectoryListingPage
- Defined in:
- lib/rawfeed/plugin/pub.rb
Overview
Defines the page that will be dynamically generated for each directory.
Instance Method Summary collapse
-
#initialize(site, base, dir, files_and_dirs) ⇒ DirectoryListingPage
constructor
A new instance of DirectoryListingPage.
Constructor Details
#initialize(site, base, dir, files_and_dirs) ⇒ DirectoryListingPage
Returns a new instance of DirectoryListingPage.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rawfeed/plugin/pub.rb', line 6 def initialize(site, base, dir, files_and_dirs) @site = site @base = base @dir = dir @name = 'index.html' @layout_name = 'pub.html' self.process(@name) theme_root = site.theme&.root || File.join(site.source, "_layouts") theme_layouts = File.join(theme_root, "_layouts") self.read_yaml(theme_layouts, "pub.html") # # Note: This is for _plugins/ # self.read_yaml(File.join(base, '_layouts'), 'pub.html') # Defines the correct permalink for the index page # Ensures that 'pub/sub/index.html' has the permalink '/pub/sub/' self.data['permalink'] = "/#{dir}/" # Title (optional, can be formatted in the layout) self.data['title'] = File.basename(dir).capitalize # THE MAGIC: Injects the content list into the page object. self.data['directory_contents'] = files_and_dirs self.data['layout'] = 'pub' end |