Skip to content

Commit 1ac64bc

Browse files
Switched xml_escape for <![CDATA[]]> for post content (#332)
Merge pull request 332
1 parent 385f455 commit 1ac64bc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/jekyll-feed/feed.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<id>{{ post.id | absolute_url | xml_escape }}</id>
6464
{% assign excerpt_only = post.feed.excerpt_only | default: site.feed.excerpt_only %}
6565
{% unless excerpt_only %}
66-
<content type="html" xml:base="{{ post.url | absolute_url | xml_escape }}">{{ post.content | strip | xml_escape }}</content>
66+
<content type="html" xml:base="{{ post.url | absolute_url | xml_escape }}"><![CDATA[{{ post.content | strip }}]]></content>
6767
{% endunless %}
6868

6969
{% assign post_author = post.author | default: post.authors[0] | default: site.author %}
@@ -96,7 +96,7 @@
9696

9797
{% assign post_summary = post.description | default: post.excerpt %}
9898
{% if post_summary and post_summary != empty %}
99-
<summary type="html">{{ post_summary | strip_html | normalize_whitespace | xml_escape }}</summary>
99+
<summary type="html"><![CDATA[{{ post_summary | strip_html | normalize_whitespace }}]]></summary>
100100
{% endif %}
101101

102102
{% assign post_image = post.image.path | default: post.image %}

spec/jekyll-feed_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
end
7777

7878
it "converts markdown posts to HTML" do
79-
expect(contents).to match %r!&lt;p&gt;March the second\!&lt;/p&gt;!
79+
expect(contents).to match %r!<\!\[CDATA\[<p>March the second\!</p>\]\]!
8080
end
8181

8282
it "uses last_modified_at where available" do

0 commit comments

Comments
 (0)