diff --git a/jekyll-feed.gemspec b/jekyll-feed.gemspec
index ed536c7e..5bd74eee 100644
--- a/jekyll-feed.gemspec
+++ b/jekyll-feed.gemspec
@@ -20,5 +20,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "typhoeus", "~> 0.7"
spec.add_development_dependency "nokogiri", "~> 1.6"
+ spec.add_development_dependency "jekyll-last-modified-at", "0.3.4"
end
diff --git a/lib/feed.xml b/lib/feed.xml
index 93854687..61b01ec0 100644
--- a/lib/feed.xml
+++ b/lib/feed.xml
@@ -30,7 +30,11 @@
{{ post.title | markdownify | strip_html | strip_newlines | xml_escape }}
{{ post.date | date_to_xmlschema }}
- {{ post.date | date_to_xmlschema }}
+ {% if post.last_modified_at %}
+ {{ post.last_modified_at | date_to_xmlschema }}
+ {% else %}
+ {{ post.date | date_to_xmlschema }}
+ {% endif %}
{{ post.id | prepend: url_base | xml_escape }}
{{ post.content | markdownify | xml_escape }}
diff --git a/spec/fixtures/_config.yml b/spec/fixtures/_config.yml
index 32bccc52..605441f1 100644
--- a/spec/fixtures/_config.yml
+++ b/spec/fixtures/_config.yml
@@ -1,5 +1,8 @@
timezone: UTC
+gems:
+ - jekyll-last-modified-at
+
defaults:
-
scope:
diff --git a/spec/jekyll-feed_spec.rb b/spec/jekyll-feed_spec.rb
index c00c43b5..56aecdb6 100644
--- a/spec/jekyll-feed_spec.rb
+++ b/spec/jekyll-feed_spec.rb
@@ -57,6 +57,10 @@
expect(contents).to match /<p>March the second!<\/p>/
end
+ it "converts uses last_modified_at where available" do
+ expect(contents).to match /2015-05-12T13:27:59\+00:00<\/updated>/
+ end
+
context "parsing" do
let(:feed) { RSS::Parser.parse(contents) }