And the ugly solution I’ve settled with is this (in the rss.xml
):
<description>{{ .Content | replaceRE "(?s)<!-- +begin_quote(.+?)end_quote +-->" "" | replaceRE "(?s)begin_quote_rss(.+?)end_quote_rss" "begin_quote_rss -->$1<!-- end_qoute_rss" | html}}</description>
Basically I placed both rendering variants into the quote.html
, surrounded by html comments, and then remove one variant and uncomment another.
This is ugly, because in the actual site I have multiple shortcodes which I want to render differently, and this leads to multiple replaceRE
pipes. But so far it works and does not produce additional *.xml
files for pages.
The solution was inspired by this: Access page meta data while building the rss feed Go template programming (Partials: pipe, use as functions, recursive)