Skip to content

<description>undefined</description> when optional description is unset #222

@Krinkle

Description

@Krinkle

Describe the bug

The options.description parameter is documented as optional, and the atom and json formats handle this by omitting this optional field in their output. The RSS2 format requires a <description> element and so we can't omit it. But, combined with the fact that the Feed class takes an optional description, means we serialize <description>undefined</description> which then ends up on-screen in feed readers.

To Reproduce
Steps to reproduce the behavior:

  • new Feed() with description unset, undefined, or empty string.
  • feed.rss2()

Example:

Expected behavior
A clear and concise description of what you expected to happen.

Actual behavior

Example: https://nodejs.org/en/feed/blog.xml

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>Node.js Blog</title>
        …
        <description>undefined</description>
        <lastBuildDate>Mon, 18 Aug 2025 19:33:35 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>

Versions (please complete the following information):

  • feed: 5.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions