I have an XML template set up for an RSS feed. The generated XML is valid if I use static strings, but errors out when using Antlers tags. For instance:
This creates valid XML
# Template
<title>My Podcast</title>
# Browser Output
<?xml version="1.0" encoding="UTF-8"?>
<title>My Podcast</title>
This doesn't
# Template
<title>{{ site_title }}</title>
# Browser Output
<?xml version="1.0" encoding="UTF-8"?>
<title>My Podcast</title>
Neither does this
# Template
{{ collection:episodes limit="1" }}
<title>Just a normal string</title>
{{ /collection:episodes }}
# Browser Output
<?xml version="1.0" encoding="UTF-8"?>
<title>Just a normal string</title>
See how the <
gets escaped into <
? Why is that? When I try to load the page, I get a nice red box with
XML Parsing Error: not well-formed
Location: http://localhost:1234/feed
Line Number 1, Column 1:
The document header has a Content Type of text/xml; charset=UTF-8
, which looks correct to me. Here's how my route is set up:
/feed:
layout: feed
template: feed
content_type: xml
Am I missing something about using Antlers in a document type other than HTML?