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.
This PR adds support for v1 of JSON Feed: https://jsonfeed.org/
It's still pretty early days for JSON Feed but feed readers are starting to support it and it was fairly straightforward to add it as an option for
feed
.Things to note from this PR:
I added 2 new top level options,
favicon
andfeedLinks
. The JSON feed spec heavily encourages including a link to the feed url and specifying a separate favicon and site image. I couldn't find analogues to these things in RSS2.0, but Atom supports both, so I made the changes to atom so setting a favicon and an image will work for both atom and JSON Feed. For feedLinks, there was an existingoptions.feed
that seemingly assumed that it was an atom feed link. Since a user might presumably want to generate both an atom and a JSON feed (since JSON feed will have limited support for a while), I felt it was necessary to add a new config object that could take both JSON and atom feed links. I maintained the existing behavior though, and the atom link will get pulled fromoptions.feed
if its available, but fallbackoptions.feedLinks.atom
. If you're on board with this, a deprecation message could possibly be added foroptions.feed
.Not all concepts that feed supports are handled by JSON feed. Contributor lists, multiple authors, and "categories" don't map cleanly to JSON Feed. I ignored most of those, but clipped authors down to the first author if multiple were given.
I fixed a typo in the README and added examples for the new fields
I parsed to JSON before testing the JSON feed output, because Jest will give nice diffs if JSON objects are different that it wouldn't be smart enough to do right if a string comparison were wrong.
I'm happy to clean up anything you're concerned about here, just let me know what you think.