Skip to content

Entries with the nodejs tag

Pull request Fallback to description when content is not provided for JSON feed on jpmonette/feed

In RSS 2 the description may contain the full text and the content can be omitted when there is not a short version available:

However a JSON feed will not contain a content_html field when the content is not provided.

This makes it hard to create both a JSON feed and an RSS 2 feed because providing content without a description will create a content:encoded field but not a description field in the RSS 2 feed.

My solution to this is to fallback to the item.description when item.content is not provided and generating a JSON feed.