Skip to content

Fix RSS feed XML parsing error by wrapping content in CDATA#71

Open
Shubhamkahar196 wants to merge 1 commit intosdslabs:masterfrom
Shubhamkahar196:fix-rss-xml-error
Open

Fix RSS feed XML parsing error by wrapping content in CDATA#71
Shubhamkahar196 wants to merge 1 commit intosdslabs:masterfrom
Shubhamkahar196:fix-rss-xml-error

Conversation

@Shubhamkahar196
Copy link
Copy Markdown

Fix RSS feed XML parsing error

This PR fixes the XML parsing error occurring in the RSS feed.

The issue happens because post.content contains HTML characters such as &, <, and > which can break XML parsing even after applying xml_escape. When the feed is generated, these characters sometimes cause the error:

xmlParseEntityRef: no name

To resolve this, the post content is wrapped inside a CDATA section. CDATA allows raw HTML content to be included without breaking the XML structure.

Changes made

  • Replaced:
    <description>{{ post.content | xml_escape }}</description>

  • With:
    <description><![CDATA[{{ post.content }}]]></description>

This ensures that HTML inside blog posts does not cause XML parsing errors in the RSS feed.

Fixes the issue related to RSS feed parsing.

@Shubhamkahar196
Copy link
Copy Markdown
Author

Hi maintainers,
I have implemented a fix for the RSS XML parsing error by wrapping the post content in a CDATA section. Please review when convenient.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant