Class: Jekyll::DirectoryListingPage
- Inherits:
-
Page
- Object
- Page
- Jekyll::DirectoryListingPage
- Defined in:
- lib/rawfeed/pub.rb
Overview
Define a página que será gerada dinamicamente para cada diretório
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 |
# File 'lib/rawfeed/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_layouts = File.join(site.theme.root, "_layouts") self.read_yaml(theme_layouts, "pub.html") # # Note: This is for _plugins/ # self.read_yaml(File.join(base, '_layouts'), 'pub.html') # Define o permalink correto para a página de índice # Garante que 'pub/sub/index.html' tenha o permalink '/pub/sub/' self.data['permalink'] = "/#{dir}/" # Título (opcional, pode ser formatado no layout) self.data['title'] = File.basename(dir).capitalize # A MÁGICA: Injeta a lista de conteúdo no objeto da página self.data['directory_contents'] = files_and_dirs self.data['layout'] = 'pub' end |