Class: Mill::Resource::Index

Inherits:
Text show all
Includes:
HTMLHelpers
Defined in:
lib/mill/resources/dir.rb

Constant Summary

Constants included from HTMLHelpers

HTMLHelpers::LinkElementsXPath

Constants inherited from Text

Text::FileTypes

Constants inherited from Mill::Resource

FileTypes

Instance Attribute Summary collapse

Attributes inherited from Text

#author, #summary, #title

Attributes inherited from Mill::Resource

#content, #date, #input_file, #output_file, #public, #site

Instance Method Summary collapse

Methods included from HTMLHelpers

#check_errors, #find_link_elements, #google_analytics, #html_document, #html_fragment, #link_if, #parse_html, #parse_html_fragment, #replace_element

Methods inherited from Text

#add_external_link_targets, #add_image_sizes, #body, #content_body, #content_head, #feed_content, #final_content, #head, #inspect, #parse_html_header, #parse_text_header, #remove_comments, #shorten_links

Methods inherited from Mill::Resource

#absolute_uri, #build, #change_frequency, #final_content, #find_sibling_resources, #inspect, #parent_uri, #public?, #save, #tag_uri, #uri

Constructor Details

#initialize(pages:, **args) ⇒ Index

Returns a new instance of Index.



11
12
13
14
# File 'lib/mill/resources/dir.rb', line 11

def initialize(pages:, **args)
  @pages = pages
  super(**args)
end

Instance Attribute Details

#pagesObject

Returns the value of attribute pages.



9
10
11
# File 'lib/mill/resources/dir.rb', line 9

def pages
  @pages
end

Instance Method Details

#loadObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/mill/resources/dir.rb', line 16

def load
  super
  @content = html_fragment do |html|
    html.dl do
      @pages.each do |page|
        html.dt(page.title)
      end
    end
  end
end