From 9e5299377a41c594c14e69873def8dcf54d49045 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sun, 1 Mar 2020 07:14:38 +1000 Subject: [PATCH] add sub/recipe layouts to _config.yml to avoid repititious repitition --- README.md | 3 --- _config.yml | 10 ++++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 31fda0d..1c2bcd2 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ Here's an example recipe, which could be saved to `_recipes/chocolate_cake.yml`: --- name: Chocolate cake author: Jane Crocker -layout: recipe ingredients: - [1, egg, null] @@ -48,7 +47,6 @@ time: 240 ``` - `name` (string) - The displayed name of the recipe. Does not appear in the URL. - `author` (string, optional) - The author of the recipe. -- `layout` (string) - The template to use; should always be `recipe`. - `ingredients` (list) - Each entry in `ingredients` consists of an amount, ingredient name, and unit terminology. `[2, flour, cups]` is displayed as `2 cups of flour`, while `[1, egg, null]` is displayed as `1 egg`. The third field is optional - `[1, egg, null]` is the same as `[1, egg]`. - `method` (list) - A list of steps undertaken to create the recipe, written in plain English. Or whatever language you prefer. - `time` (string, optional) - The time it takes to make the recipe in minutes. @@ -72,7 +70,6 @@ name: Example Subrecipes behave a little differently to regular recipes: - They don't show up on the home page - The `time` tag is not supported -- `layout` should be `subrecipe` Subrecipes have a tag that regular recipes do not - the `parents` tag. This is a list of recipes that the subrecipe should be included in. For example: ```yaml diff --git a/_config.yml b/_config.yml index 2497de7..c2ecf9e 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,13 @@ +defaults: + - scope: + path: "_recipes" + values: + layout: "recipe" + - scope: + path: "_subrecipes" + values: + layout: "subrecipe" + collections: # note: subrecipes MUST come before recipes, otherwise subrecipe.output will be empty with no error message given. thanks to https://github.com/jekyll/jekyll/issues/5371#issuecomment-247951926 subrecipes: