diff --git a/lib/jekyll-feed/meta-tag.rb b/lib/jekyll-feed/meta-tag.rb index 76da23f0..6a47a095 100644 --- a/lib/jekyll-feed/meta-tag.rb +++ b/lib/jekyll-feed/meta-tag.rb @@ -7,7 +7,7 @@ class MetaTag < Liquid::Tag def render(context) @context = context - attrs = attributes.map { |k, v| %(#{k}="#{v}") }.join(" ") + attrs = attributes.map { |k, v| %(#{k}=#{v.encode(:xml => :attr)}) }.join(" ") "" end diff --git a/spec/jekyll-feed_spec.rb b/spec/jekyll-feed_spec.rb index aa5596fb..8df3d4d7 100644 --- a/spec/jekyll-feed_spec.rb +++ b/spec/jekyll-feed_spec.rb @@ -207,6 +207,15 @@ expect(feed.title.content).to eql(site_title) end end + + context "with site.title has special characters" do + let(:site_title) { "My Site Title <&>" } + let(:overrides) { { "title" => site_title } } + + it "uses encoded site.title for the title" do + expect(feed.title.content).to eql(site_title.encode(xml: :text)) + end + end end context "smartify" do