feat: Add tag/category support to all feed formats (v1.3.1)
Implements tag/category rendering in RSS 2.0, Atom 1.0, and JSON Feed 1.1 syndication feeds. Tags added in v1.3.0 are now visible to feed readers. Changes: - Load tags in feed generation (_get_cached_notes) - Add <category> elements to RSS 2.0 feeds - Add <category term/label> to Atom 1.0 feeds - Add "tags" array to JSON Feed 1.1 items - Omit empty tags field in JSON Feed (minimal approach) Standards compliance: - RSS 2.0: category element with display name - Atom 1.0: RFC 4287 category with term and label attributes - JSON Feed 1.1: tags array of strings Per design: docs/design/v1.3.1/feed-tags-design.md Implementation: docs/design/v1.3.1/2025-12-10-feed-tags-implementation.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -142,6 +142,11 @@ def generate_rss(
|
||||
# feedgen automatically wraps content in CDATA for RSS
|
||||
fe.description(html_content)
|
||||
|
||||
# Add category elements for tags (v1.3.1)
|
||||
if hasattr(note, 'tags') and note.tags:
|
||||
for tag in note.tags:
|
||||
fe.category({'term': tag['display_name']})
|
||||
|
||||
# Add RSS enclosure element (first image only, per RSS 2.0 spec)
|
||||
if hasattr(note, 'media') and note.media:
|
||||
first_media = note.media[0]
|
||||
@@ -293,6 +298,12 @@ def generate_rss_streaming(
|
||||
item_xml += f"""
|
||||
<description><![CDATA[{html_content}]]></description>"""
|
||||
|
||||
# Add category elements for tags (v1.3.1)
|
||||
if hasattr(note, 'tags') and note.tags:
|
||||
for tag in note.tags:
|
||||
item_xml += f"""
|
||||
<category>{_escape_xml(tag['display_name'])}</category>"""
|
||||
|
||||
# Add media:content elements (all images)
|
||||
if hasattr(note, 'media') and note.media:
|
||||
for media_item in note.media:
|
||||
|
||||
Reference in New Issue
Block a user