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

Allow json files in _data dir #2369

Merged
merged 4 commits into from May 9, 2014

Conversation

Projects
None yet
7 participants
@benbalter
Contributor

benbalter commented May 9, 2014

Per @holic's excellent comment over in github/pages-gem#64 (comment), any valid JSON with a .yaml extension in the _data directory is valid YAML and can be read it. Tested locally, and it appears to be true.

This pull request simply expands the allowed file extensions to be read in from yml and yaml to also include json.

Todo

  • Tests
  • Update docs
@holic

This comment has been minimized.

Show comment
Hide comment
@holic

holic May 9, 2014

Contributor

👍

Contributor

holic commented May 9, 2014

👍

Show outdated Hide outdated site/docs/datafiles.md

@benbalter benbalter referenced this pull request May 9, 2014

Closed

jsonball plugin added #64

@mattr-

This comment has been minimized.

Show comment
Hide comment
@mattr-

mattr- May 9, 2014

Member

❤️ Thanks @benbalter!

Member

mattr- commented May 9, 2014

❤️ Thanks @benbalter!

mattr- added a commit that referenced this pull request May 9, 2014

@mattr- mattr- merged commit 50065a2 into master May 9, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

mattr- added a commit that referenced this pull request May 9, 2014

@mattr- mattr- deleted the json-data branch May 9, 2014

@doktorbro

This comment has been minimized.

Show comment
Hide comment
@doktorbro

doktorbro May 9, 2014

Member

Love it! This feature will bring Jekyll many friends.

Member

doktorbro commented May 9, 2014

Love it! This feature will bring Jekyll many friends.

@doktorbro

This comment has been minimized.

Show comment
Hide comment
@doktorbro

doktorbro May 9, 2014

Member

What happens if members.json and members.yaml exist?

Member

doktorbro commented May 9, 2014

What happens if members.json and members.yaml exist?

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr May 9, 2014

Member

What happens if members.json and members.yaml exist?

Good point. @benbalter Could you please add a test for this?

Member

parkr commented May 9, 2014

What happens if members.json and members.yaml exist?

Good point. @benbalter Could you please add a test for this?

@holic

This comment has been minimized.

Show comment
Hide comment
@holic

holic May 10, 2014

Contributor

Is it also worth mentioning in the docs that JSON is valid frontmatter? How about _config.json?

Contributor

holic commented May 10, 2014

Is it also worth mentioning in the docs that JSON is valid frontmatter? How about _config.json?

@mscharley

This comment has been minimized.

Show comment
Hide comment
@mscharley

mscharley May 10, 2014

Contributor

I don't think that JSON is valid frontmatter is it? Sure, the YAML parser
will parse it, but does it create something useful for frontmatter?

On 10 May 2014 12:22, Kevin Ingersoll notifications@github.com wrote:

Is it also worth mentioning in the docs that JSON is valid frontmatter?
How about _config.json?


Reply to this email directly or view it on GitHubhttps://github.com/jekyll/jekyll/pull/2369#issuecomment-42729276
.

Contributor

mscharley commented May 10, 2014

I don't think that JSON is valid frontmatter is it? Sure, the YAML parser
will parse it, but does it create something useful for frontmatter?

On 10 May 2014 12:22, Kevin Ingersoll notifications@github.com wrote:

Is it also worth mentioning in the docs that JSON is valid frontmatter?
How about _config.json?


Reply to this email directly or view it on GitHubhttps://github.com/jekyll/jekyll/pull/2369#issuecomment-42729276
.

@holic

This comment has been minimized.

Show comment
Hide comment
@holic

holic May 10, 2014

Contributor

Not particularly useful (YAML is easier to read/maintain), but AFAIK this:

---
layout: post
title: Some post title
---

is equivalent to this:

---
{
  "layout": "post",
  "title": "Some post title"
}
---
Contributor

holic commented May 10, 2014

Not particularly useful (YAML is easier to read/maintain), but AFAIK this:

---
layout: post
title: Some post title
---

is equivalent to this:

---
{
  "layout": "post",
  "title": "Some post title"
}
---

mattbostock added a commit to gds-operations/gds-operations.github.io that referenced this pull request Jul 7, 2014

Add a Projects page linking to our GitHub repos
Add a Projects page which uses Jekyll's ability to read custom data from
JSON and YAML files[1] to present a list of our GitHub repositories
based on JSON data pulled from the GitHub API.

The JSON data is stored in the `_data` directory and can be updated
using the Rake task added in this commit:

```bash
bundle exec rake update_repo_data
```

Note that we use the `.yml` extension rather than `.json` because, as
of version 2.0.3, Jekyll doesn't support data files that use the .json
extension[2], even though it will interpret them if they are given a
YAML extension (presumably because YAML is a superset of JSON). We can
use `.json` once [this
issue](jekyll/jekyll#2369) is included in a
Jekyll release.

[1]: http://jekyllrb.com/docs/datafiles/
[2]: jekyll/jekyll#2441

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.