feat: add RSS 2.0 feed generation support#240
Closed
gumruyanzh wants to merge 1 commit intojetzig-framework:mainfrom
Closed
feat: add RSS 2.0 feed generation support#240gumruyanzh wants to merge 1 commit intojetzig-framework:mainfrom
gumruyanzh wants to merge 1 commit intojetzig-framework:mainfrom
Conversation
Add jetzig.Rss module for generating valid RSS 2.0 XML feeds.
- RSS builder with Channel and Item structs for structured feed data
- XML escaping for special characters (&, <, >, ", ')
- Optional fields: language, pubDate, lastBuildDate, guid, author
- Exported as jetzig.Rss for use in views via request.renderText()
- Demo view showing RSS feed endpoint usage
- Unit tests for minimal feed, items, and XML escaping
Usage in a view:
const channel = jetzig.Rss.Channel{ .title = "My Blog", ... };
const xml = try jetzig.Rss.generate(request.allocator, channel);
request.response.content_type = "application/rss+xml";
return request.renderText(xml, .ok);
Closes #36
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jetzig.Rssmodule for generating valid RSS 2.0 XML feedsChannelandItemstructs with proper XML escapingjetzig.Rssso views can userequest.renderText()to serve feedsdemo/src/app/views/feed.zig) showing the patternDesign
Rather than middleware, this takes the utility-module approach: views generate RSS XML using the builder and return it via
request.renderText()withcontent_type = "application/rss+xml". This is consistent with how the framework already handles custom content types (seerender_text.zigdemo).Example usage
Test plan
zig buildsucceedszig build test --summary all- all 75 tests passzig test src/jetzig/Rss.zig- 3/3 RSS unit tests pass (minimal feed, items, XML escaping)Closes #36
🤖 Generated with Claude Code