From 460d9c1c443c81ffac95c7d5a496506feded33fe Mon Sep 17 00:00:00 2001 From: Jens Nazarenus Date: Sun, 1 Jun 2014 21:53:21 +0200 Subject: [PATCH] Adds an example how to use frontmatter defaults with collections --- site/docs/configuration.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/site/docs/configuration.md b/site/docs/configuration.md index e9a21db7..23b16e9a 100644 --- a/site/docs/configuration.md +++ b/site/docs/configuration.md @@ -309,7 +309,8 @@ defaults: layout: "default" {% endhighlight %} -Now, this will only set the layout for files where the type is `post`. The different types that are available to you are `page`, `post`, or `draft`. While `type` is optional, you must specify a value for `path` when creating a `scope/values` pair. +Now, this will only set the layout for files where the type is `post`. +The different types that are available to you are `page`, `post`, `draft` or any collection in your site. While `type` is optional, you must specify a value for `path` when creating a `scope/values` pair. As mentioned earlier, you can set multiple scope/values pairs for `defaults`. @@ -333,6 +334,22 @@ defaults: With these defaults, all posts would use the `my-site` layout. Any html files that exist in the `projects/` folder will use the `project` layout, if it exists. Those files will also have the `page.author` [liquid variable](../variables/) set to `Mr. Hyde` as well as have the category for the page set to `project`. +{% highlight yaml %} +collections: + - my_collection: + output: true + +defaults: + - + scope: + path: "" + type: "my_collection" # a collection in your site + values: + layout: "default" +{% endhighlight %} + +In this example the `layout` is set to `default` inside the [collection](../collections) with the name `my_collection`. + ### Precedence Jekyll will apply all of the configuration settings you specify in the `defaults` section of your `_config.yml` file. However, you can choose to override settings from other scope/values pair by specifying a more specific path for the scope.