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
Conversation
👍 |
@@ -22,7 +22,7 @@ Plugins/themes can also leverage Data Files to set configuration variables. | |||
|
|||
As explained on the [directory structure](../structure/) page, the `_data` | |||
folder is where you can store additional data for Jekyll to use when generating | |||
your site. These files must be YAML files (using either the `.yml` or `.yaml` | |||
your site. These files must be YAML files (using either the `.yml`, `.yaml` or `json` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot a dot 😄
❤️ Thanks @benbalter! |
Love it! This feature will bring Jekyll many friends. |
What happens if |
Good point. @benbalter Could you please add a test for this? |
Is it also worth mentioning in the docs that JSON is valid frontmatter? How about |
I don't think that JSON is valid frontmatter is it? Sure, the YAML parser On 10 May 2014 12:22, Kevin Ingersoll notifications@github.com wrote:
|
Not particularly useful (YAML is easier to read/maintain), but AFAIK this:
is equivalent to this:
|
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
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
andyaml
to also includejson
.Todo