Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to description when content is not provided for JSON feed #160

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JosephDuffy
Copy link

In RSS 2 the description may contain the full text and the content can be omitted when there is not a short version available: https://cyber.harvard.edu/rss/rss.html#hrelementsOfLtitemgt

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.

In RSS 2 the description may contain the full text and the content can be omitted when there is not a short version available: https://cyber.harvard.edu/rss/rss.html#hrelementsOfLtitemgt

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.
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.

None yet

1 participant