From 418c978b9140868d8bd681627abd2cdee67298a0 Mon Sep 17 00:00:00 2001 From: Rodrigo Dumont Date: Mon, 12 May 2014 11:21:31 -0300 Subject: [PATCH] Add _data sub-folder support to docs --- site/docs/datafiles.md | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) 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 %} + +{% endraw %} +{% endhighlight %}