diff --git a/lib/perron/site/builder/feeds/atom.erb b/lib/perron/site/builder/feeds/atom.erb index a54332b..45f40a2 100644 --- a/lib/perron/site/builder/feeds/atom.erb +++ b/lib/perron/site/builder/feeds/atom.erb @@ -1,10 +1,10 @@ Perron - <%= current_feed_url %> + <%= current_feed_url.call %> <%= config.title.presence || @configuration.site_name %> <%= config.description.presence || @configuration.site_description %> - + <%= resources.first&.published_at&.iso8601 || Time.current.iso8601 %> @@ -16,20 +16,20 @@ <% resources.each do |resource| %> - <%= url_for_resource(resource) || "#{@configuration.url}/posts/#{resource.id}" %> + <%= url_for_resource.call(resource) || "#{@configuration.url}/posts/#{resource.id}" %> <%= resource.metadata.title %> - + <%= resource.published_at&.iso8601 %> <%= (resource.metadata.updated_at || resource.published_at)&.iso8601 %> - <% entry_author = author(resource); if entry_author %> + <% entry_author = author.call(resource); if entry_author %> <% if entry_author.name %><%= entry_author.name %><% end %> <% if entry_author.email %><%= entry_author.email %><% end %> <% end %> - <% base_url = url_for_resource(resource) %> + <% base_url = url_for_resource.call(resource) %> <% if base_url %> ]]> <% else %> diff --git a/lib/perron/site/builder/feeds/rss.erb b/lib/perron/site/builder/feeds/rss.erb index a8d1548..cdb3965 100644 --- a/lib/perron/site/builder/feeds/rss.erb +++ b/lib/perron/site/builder/feeds/rss.erb @@ -10,14 +10,14 @@ <%= resource.id %> - <% resource_url = url_for_resource(resource) %> + <% resource_url = url_for_resource.call(resource) %> <% if resource_url %> <%= resource_url %> <% end %> <%= resource.published_at&.rfc822 %> - <% author = author(resource); if author && author.email %> - <%= author.name ? "#{author.email} (#{author.name})" : author.email %> + <% entry_author = author.call(resource); if entry_author && entry_author.email %> + <%= entry_author.name ? "#{entry_author.email} (#{entry_author.name})" : entry_author.email %> <% end %> <%= resource.metadata.title %> diff --git a/test/perron/site/builder/feeds_test.rb b/test/perron/site/builder/feeds_test.rb index 5d57f2c..d054bc9 100644 --- a/test/perron/site/builder/feeds_test.rb +++ b/test/perron/site/builder/feeds_test.rb @@ -157,4 +157,33 @@ class Perron::Site::Builder::FeedsTest < ActiveSupport::TestCase assert output.start_with?("#{Regexp.escape(feed_url)}<\/id>/, output, "Feed id should contain actual URL") + assert_match(/]*rel="self"/, output, "Self link should contain actual URL") + end end