Class: Mill::Resource::Feed
- Inherits:
-
Mill::Resource
- Object
- Mill::Resource
- Mill::Resource::Feed
- Includes:
- HTMLHelpers
- Defined in:
- lib/mill/resources/feed.rb
Constant Summary
Constants included from HTMLHelpers
HTMLHelpers::LinkElementsXPath
Constants inherited from Mill::Resource
Instance Attribute Summary
Attributes inherited from Mill::Resource
#content, #date, #input_file, #output_file, #public, #site, #type
Instance Method Summary collapse
Methods included from HTMLHelpers
#amazon_button, #check_errors, #find_link_elements, #google_analytics, #html_document, #html_fragment, #link_if, #parse_html, #parse_html_fragment, #paypal_button, #replace_element
Methods inherited from Mill::Resource
#absolute_uri, #change_frequency, #final_content, #find_sibling_resources, #initialize, #inspect, #load, #parent_uri, #public?, #save, #tag_uri, #uri
Constructor Details
This class inherits a constructor from Mill::Resource
Instance Method Details
#build ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mill/resources/feed.rb', line 11 def build resources = @site.feed_resources builder = Nokogiri::XML::Builder.new do |xml| xml.feed(xmlns: 'http://www.w3.org/2005/Atom') do xml.id(@site.tag_uri) # xml.generator(*@site.feed_generator) xml.title(@site.site_title) if @site.site_title xml.link(rel: 'alternate', type: 'text/html', href: @site.home_resource.uri) if @site.home_resource xml.link(rel: 'self', type: 'application/atom+xml', href: uri) xml. do xml.name(@site.) if @site. xml.uri(@site.) if @site. xml.email(@site.) if @site. end xml.updated(resources.last.date.iso8601) unless resources.empty? resources.each do |resource| xml.entry do xml.title(resource.title) if resource.title xml.link(rel: 'alternate', href: resource.uri) xml.id(resource.tag_uri) xml.updated(resource.date.iso8601) xml.published(resource.date.iso8601) if (html = resource.feed_content) xml.content(type: 'html') { xml.cdata(html.to_html) } end end end end end @content = builder.doc super end |
#link_html ⇒ Object
44 45 46 47 48 |
# File 'lib/mill/resources/feed.rb', line 44 def link_html html_fragment do |html| html.link(href: uri, rel: 'alternate', type: 'application/atom+xml') end end |