-
Notifications
You must be signed in to change notification settings - Fork 310
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
Exposes _data/team.yml as publicly accessible JSON #296
Conversation
Love this idea, let's do it. I think it'd be better to use Jekyll's built in |
+100 Please make sure we mention this on our /developer page. |
Now that's interesting. Looks like JekyllBot is abandoned, though. I bet we could create a pretty simple JSON content API ourselves with today's Jekyll, or through a Jekyll plugin? |
@gboone is this good to go? |
Well, it is in that it works (it generates something) but it generates an HTML file that has JSON in it. So, I don't think so, no. |
Previous solutions have created json by using a page template. That's fine but actually generates an html file with json in the body. In addition to sending the data with the wrong content-type it also is rendered as html by browsers, javascript, etc., and would have required more maintenance for new data sets. This commit exposes an endpoint at `/api/<data>.json` for every dataset in the _data directory. For example, this site will have _data/team.yml exposed at `/api/team.json`
This should work now. Testing it locally I get valid JSON with the correct headers at |
Exposes _data/team.yml as publicly accessible JSON
I'm not sure if this will actually work (it should but my localhost webrick server was serving the generated file with
Content-Type: text/html
instead ofapplication/JSON
) but this would expose the team member data we have in_data
as an api endpoint and allow us to access it in any of our other projects (like dashboard) as well as in javascript on the front end.Leaving this here for discussion.