About RSS template customization

Hello.

I wanted to deliver the full text in an RSS feed, so I created my own template.
Among them, there is a part that outputs as follows.

      {{ with .Content }}<content:encoded><![CDATA[{{ . | safeHTML }}]]></content:encoded>{{ end }}

However, when I output an RSS feed with this template, <![CDATA[ is replaced by &lt;![CDATA[.
How can I properly output this as <![CDATA[?
I would appreciate any advice.

Best regards.

{{ with .Content }}<content:encoded>
{{ `<![CDATA[` | safeHTML }}
{{ . | safeHTML }}
{{ `]]>` | safeHTML }}
</content:encoded>{{ end }}

or using printf

{{ with .Content }}<content:encoded>
{{ printf `<![CDATA[%s]]>` . | safeHTML }}
</content:encoded>{{ end }}

Hello.

It worked.
Thank you.

Best regards.

1 Like

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