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

💡 RFC: Support for JSON feeds #1113

Closed
1 of 3 tasks
brycewray opened this issue Aug 14, 2021 · 8 comments
Closed
1 of 3 tasks

💡 RFC: Support for JSON feeds #1113

brycewray opened this issue Aug 14, 2021 · 8 comments

Comments

@brycewray
Copy link
Contributor

Background & Motivation

Just as there currently is a way to produce an RSS feed, I would like for there to be also a way to produce a JSON feed (for more information about this, see https://jsonfeed.org). In my Eleventy site I was able to adapt an RSS-generating template to do this, so am hoping it's similarly easy to do this in Astro.

Proposed Solution

Possible solutions

  1. Adapt the rss object so that it can also produce JSON feeds.
  2. Create a similar object (jsonfeed?) to produce JSON feeds.

Alternatives considered

N/A

Risks, downsides, and/or tradeoffs

Given that many newsreader apps support both RSS and JSON feeds and that there are certain advantages to the latter (as noted at https://www.jsonfeed.org/2017/05/17/announcing-json-feed.html), it would be unfortunate if Astro lacked this ability.

Open Questions

N/A

Note: I lack the coding ability to provide a PR, hence my answer under "Help make it happen!" Wish I could help in that regard.

Detailed Design

No response

Help make it happen!

  • I am willing to submit a PR to implement this change.
  • I am willing to submit a PR to implement this change, but would need some guidance.
  • I am not willing to submit a PR to implement this change.
@jasikpark
Copy link
Contributor

I would love to see this happen as well for the automatic rss support + potentially as another example of generating non-html files based on Astro data.

@drwpow
Copy link
Member

drwpow commented Aug 16, 2021

There’s not really any technical limitations from this happening. In theory we could also support JSON feed, Atom 1.0, and anything else. Worst case scenario would just be a bit of boilerplate, but it’d still be much better than the alternative of doing everything yourself from scratch (and would still have the efficiency benefit of rendering all your HTML for multiple pages and some schema file from the same fetch call, which is as good as it gets).

@tony-sull
Copy link
Contributor

This could be a nice help for quick Algolia support as well. I've seen a few 11ty projects that take advantage of it's data pipeline and templating to build an algolia.json file used to populate search results

@matthewp
Copy link
Contributor

@brycewray #1305 is a general solution to dynamically creating files. Does that fulfill this issue, if it were to be accepted?

@brycewray
Copy link
Contributor Author

@matthewp Probably, but I agree with the comment in that issue re seeing how other SSGs do it. I know Eleventy does it through a plugin (https://www.11ty.dev/docs/plugins/rss/) and Hugo does it through built-in Go templates (https://gohugo.io/templates/rss/).

@jasikpark
Copy link
Contributor

It would definitely be nice to include the ability to import external file templates from npm - so there can be a package that allows you to create a json feed via the endpoint api or whatever we end up doing, rather than requiring you to write your own / have one holy implementation 😁

@drwpow
Copy link
Member

drwpow commented Oct 5, 2021

IMO #1305 could be a general-purpose solution, even for RSS, and including JSON feeds. I’d want to merge this RFC into that, if possible.

@FredKSchott
Copy link
Member

Hey everyone! Our current RFC process is beginning to break down at this size, with over 50 open RFCs currently in the "discussing" stage. A growing community is a great problem to have, but our ability to give you RFC feedback has suffered as a result. In an effort to improve our RFC process, we are making some changes to better organize things.

From now on, all RFCs will live in a standalone repo: https://github.com/withastro/rfcs

This allows us to do three things: 1) Use threaded discussions for high-level ideas and improvements, without necessarily requiring an implementation for every idea. 2) Improve the quality of our RFC template and the speed/quality of all feedback. 3) Support inline comments and explicit approvals on RFCs, via a new Pull Request review process.

We hope that this new process leads to better RFC weekly calls and faster feedback on your RFCs from maintainers. More detail can be found in the new RFC repo README.


We can't automatically convert this issue to an RFC in the new repo because new RFC template is more detailed that this one. But, you can still continue this discussion in the new repo by creating a new Discussion in the RFC repo and copy-and-pasting this post (and any relevant follow-up comments) into it. Discussions are available for high-level ideas and suggestions without the requirement of a full implementation proposal.

Then, when you are ready to propose (or re-propose) an implementation for feedback and approval, you can create a new RFC using the new RFC template. More detail about how to do this can be found in the new RFC repo README.

Thanks for your patience as we attempt to improve things for both authors and reviewers. If you have any questions, don't hesitate to reach out on Discord. https://astro.build/chat

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

No branches or pull requests

6 participants