lib/nanoc/helpers/blogging.rb in nanoc-4.9.0 vs lib/nanoc/helpers/blogging.rb in nanoc-4.9.1

- old
+ new

@@ -27,10 +27,12 @@ class AtomFeedBuilder include Nanoc::Helpers::Blogging attr_accessor :config + attr_accessor :alt_link + attr_accessor :id attr_accessor :limit attr_accessor :relevant_articles attr_accessor :preserve_order attr_accessor :content_proc attr_accessor :excerpt_proc @@ -108,18 +110,18 @@ def build_for_feed(xml) root_url = @config[:base_url] + '/' xml.instruct! xml.feed(xmlns: 'http://www.w3.org/2005/Atom', 'xml:base' => root_url) do # Add primary attributes - xml.id root_url + xml.id(id || root_url) xml.title title # Add date xml.updated(updated.__nanoc_to_iso8601_time) # Add links - xml.link(rel: 'alternate', href: root_url) + xml.link(rel: 'alternate', href: (alt_link || root_url)) xml.link(rel: 'self', href: feed_url) # Add author information xml.author do xml.name author_name @@ -173,10 +175,12 @@ # @option params [Number] :limit # @option params [Array] :articles # @option params [Boolean] :preserve_order # @option params [Proc] :content_proc # @option params [Proc] :excerpt_proc + # @option params [String] :alt_link + # @option params [String] :id # @option params [String] :title # @option params [String] :author_name # @option params [String] :author_uri # @option params [String] :icon # @option params [String] :logo @@ -187,9 +191,11 @@ # Create builder builder = AtomFeedBuilder.new(@config, @item) # Fill builder + builder.alt_link = params[:alt_link] + builder.id = params[:id] builder.limit = params[:limit] || 5 builder.relevant_articles = params[:articles] || articles || [] builder.preserve_order = params.fetch(:preserve_order, false) builder.content_proc = params[:content_proc] || ->(a) { a.compiled_content(snapshot: :pre) } builder.excerpt_proc = params[:excerpt_proc] || ->(a) { a[:excerpt] }