lib/nanoc3/helpers/blogging.rb in nanoc3-3.0.2 vs lib/nanoc3/helpers/blogging.rb in nanoc3-3.0.3
- old
+ new
@@ -171,21 +171,25 @@
xml.uri @item[:author_uri]
end
# Add articles
sorted_relevant_articles.each do |a|
+ # Get URL
+ url = url_for(a)
+ next if url.nil?
+
xml.entry do
# Add primary attributes
xml.id atom_tag_for(a)
xml.title a[:title], :type => 'html'
# Add dates
xml.published Time.parse(a[:created_at]).to_iso8601_time
xml.updated a.mtime.to_iso8601_time
# Add link
- xml.link(:rel => 'alternate', :href => url_for(a))
+ xml.link(:rel => 'alternate', :href => url)
# Add content
summary = excerpt_proc.call(a)
xml.content content_proc.call(a), :type => 'html'
xml.summary summary, :type => 'html' unless summary.nil?
@@ -202,10 +206,15 @@
# Check attributes
if @site.config[:base_url].nil?
raise RuntimeError.new('Cannot build Atom feed: site configuration has no base_url')
end
- @site.config[:base_url] + (item[:custom_path_in_feed] || item.reps[0].path)
+ # Get path
+ path = item[:custom_path_in_feed] || item.reps[0].path
+ return nil if path.nil?
+
+ # Build URL
+ @site.config[:base_url] + path
end
# Returns the URL of the feed. It will return the custom feed URL if set,
# or otherwise the normal feed URL.
def feed_url