Markdown for XML RSS feed files not working

1. My Caddy version (caddy -version):

Caddy 0.11.0 (+1f7b5ab Thu May 10 15:51:18 UTC 2018) (unofficial)
1 file changed, 1 insertion(+), 1 deletion(-)
caddy/caddymain/run.go

2. How I run Caddy:

systemd

a. System environment:

Ubuntu Bionic.

3. The problem I’m having:

I’m trying to set up a Markdown powered blog. I have a simple shell script that reads the various Markdown files I have uploaded and creates an index.xml file for an RSS 2.0 feed. This document is filled with the Markdown from the original files, plus the necessary XML.

In my Caddyfile, I have:

  markdown /test {
    extensions .md .xml
  }

As I read the Markdown docs, the above snippet should pass an index.xml file through the Markdown processor. This seems not to be the case: when I load the index.xml file in my browser (or curl), I see the raw unprocessed Markdown content.

Here is an example of the index.xml file:

<?xml version="1.0"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel>
<title>skippy.net</title><link>https://skippy.net/</link>
<description>I have no idea</description><language>en-us</language>
<pubDate>Mon, 04 Nov 2019 09:27:30 -0500</pubDate><generator>skippy</generator>
<atom:link href="https://skippy.rocks/test/" rel="self" type="application/rss+xml" />
<item><link>https://skippy.rocks/test/2019/11/04/0927</link><description><![CDATA[Just another test. ]]></description><pubDate>Mon, 04 Nov 2019 09:27:00 -0500</pubDate><guid>https://skippy.rocks/test/2019/11/04/0927</guid></item>
<item><link>https://skippy.rocks/test/2019/11/04/0907</link><description><![CDATA[Look at these dice!


![](https://skippy.rocks/test/images/2019/11/IMG_2127.jpeg)]]></description><pubDate></pubDate><guid>https://skippy.rocks/test/2019/11/04/0907</guid></item>
<item><link>https://skippy.rocks/test/2019/11/03/2201</link><description><![CDATA[Purple broccoli!


![](https://skippy.rocks/test/images/2019/11/IMG_2129.jpeg)]]></description><pubDate>Sun, 03 Nov 2019 22:01:00 -0500</pubDate><guid>https://skippy.rocks/test/2019/11/03/2201</guid></item>
</channel></rss>

And the output:

$ curl https://skippy.rocks/test/index.xml
<?xml version="1.0"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel>
<title>skippy.net</title><link>https://skippy.net/</link>
<description>I have no idea</description><language>en-us</language>
<pubDate>Mon, 04 Nov 2019 09:27:30 -0500</pubDate><generator>skippy</generator>
<atom:link href="https://skippy.rocks/test/" rel="self" type="application/rss+xml" />
<item><link>https://skippy.rocks/test/2019/11/04/0927</link><description><![CDATA[Just another test. ]]></description><pubDate>Mon, 04 Nov 2019 09:27:00 -0500</pubDate><guid>https://skippy.rocks/test/2019/11/04/0927</guid></item>
<item><link>https://skippy.rocks/test/2019/11/04/0907</link><description><![CDATA[Look at these dice!


![](https://skippy.rocks/test/images/2019/11/IMG_2127.jpeg)]]></description><pubDate></pubDate><guid>https://skippy.rocks/test/2019/11/04/0907</guid></item>
<item><link>https://skippy.rocks/test/2019/11/03/2201</link><description><![CDATA[Purple broccoli!


![](https://skippy.rocks/test/images/2019/11/IMG_2129.jpeg)]]></description><pubDate>Sun, 03 Nov 2019 22:01:00 -0500</pubDate><guid>https://skippy.rocks/test/2019/11/03/2201</guid></item>
</channel></rss>

Raw Markdown, no HTML conversion.

Am I overlooking something simple? Have I misunderstood the documentation?

Thanks!

Update: if I move my feed into a new directory, /test/feed/index.md, I can get the Markdown processor to work on this file; but it’s helpfully adding <p></p> tags around {{.Doc.body}}, which breaks the XML.

I had hoped to avoid generating real HTML, and to allow Caddy to parse Markdown when serving the RSS feed; but that seems not to be an easy thing to do. I’ve punted to installing pandoc and invoking that to convert the Markdown source for each feed entry into HTML for inclusion in the feed file. No Caddy parsing or templating needed now.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.