Adds an example how to use frontmatter defaults with collections
This commit is contained in:
		
							parent
							
								
									ae67940544
								
							
						
					
					
						commit
						460d9c1c44
					
				|  | @ -309,7 +309,8 @@ defaults: | ||||||
|       layout: "default" |       layout: "default" | ||||||
| {% endhighlight %} | {% 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`. | 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`. | 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 | ### 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. | 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. | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue