lib/nanoc3/helpers/blogging.rb in nanoc3-3.1.0b1 vs lib/nanoc3/helpers/blogging.rb in nanoc3-3.1.0b2
- old
+ new
@@ -62,10 +62,15 @@
# * `custom_path_in_feed` — The path that will be used instead of the
# normal path in the feed. This can be useful when including
# non-outputted items in a feed; such items could have their custom feed
# path set to the blog path instead, for example.
#
+ # * `custom_url_in_feed` — The url that will be used instead of the
+ # normal url in the feed (generated from the site’s base url + the item
+ # rep’s path). This can be useful when building a link-blog where the
+ # URL of article is a remote location.
+ #
# * `updated_at` — The time when the article was last modified. If this
# attribute is not present, the `created_at` attribute will be used as
# the time when the article was last modified.
#
# The site configuration will need to have the following attributes:
@@ -253,15 +258,17 @@
# Check attributes
if @site.config[:base_url].nil?
raise RuntimeError.new('Cannot build Atom feed: site configuration has no base_url')
end
- # Get path
- path = item[:custom_path_in_feed] || item.path
- return nil if path.nil?
-
# Build URL
- @site.config[:base_url] + path
+ if item[:custom_url_in_feed]
+ item[:custom_url_in_feed]
+ elsif item[:custom_path_in_feed]
+ @site.config[:base_url] + item[:custom_path_in_feed]
+ elsif item.path
+ @site.config[:base_url] + item.path
+ end
end
# Returns the URL of the feed. It will return the custom feed URL if set,
# or otherwise the normal feed URL.
#