diff --git a/site/docs/datafiles.md b/site/docs/datafiles.md index 05e59345..dbac1dec 100644 --- a/site/docs/datafiles.md +++ b/site/docs/datafiles.md @@ -61,3 +61,47 @@ You can now render the list of members in a template: {% endraw %} {% endhighlight %} + +## Example: Organizations + +Data files can also be placed in sub-folders of the `_data` folder. Each folder level will be added to a variable's namespace. The example bellow shows how GitHub organizations could be defined separately in a file under the `orgs` folder: + +In `_data/orgs/jekyll.yml`: + +{% highlight yaml %} +username: jekyll +name: Jekyll +members: + - name: Tom Preston-Werner + github: mojombo + + - name: Parker Moore + github: parkr +{% endhighlight %} + +In `_data/orgs/doeorg.yml`: + +{% highlight yaml %} +username: doeorg +name: Doe Org +members: + - name: John Doe + github: jdoe +{% endhighlight %} + +The organizations can then be accessed via `site.data.orgs`, followed by the file name: + +{% highlight html %} +{% raw %} +