recipe-site/README.md

114 lines
4.9 KiB
Markdown
Raw Normal View History

2020-02-29 15:42:47 +00:00
# recipe-site
[![Build Status](https://drone.bune.city/api/badges/lynnesbian/recipe-site/status.svg)](https://drone.bune.city/lynnesbian/recipe-site)
2020-02-29 15:42:47 +00:00
2020-02-29 20:36:58 +00:00
A simple static [Jekyll](https://jekyllrb.com) site for keeping track of recipes. This is my first major Jekyll project, so it might be a little messy. **This project is a work in progress.**
## Usage
Ensure that you have [Git](https://git-scm.org), [Ruby](https://www.ruby-lang.org) and [RubyGems](https://rubygems.org/) installed.
2020-02-29 20:44:29 +00:00
Assuming a Unix system:
```
$ git clone https://git.bune.city/lynnesbian/recipe-site
$ cd recipe-site
$ gem install bundler
$ bundle install
$ bundle exec jekyll build
```
2020-02-29 20:36:58 +00:00
This will compile the website into the `_site` directory, which you may serve with any HTTP server. It is necessary to re-run `bundle exec jekyll build` after any modifications.
Alternatively, you can use jekyll's built in server for testing:
```
$ bundle exec jekyll serve
```
2020-02-29 20:36:58 +00:00
_The built in server will automatically regenerate the `_site` output whenever you make a change._
However, there won't be much to look at until you add some recipes!
## Recipe file format
Recipes are found in `_recipes/`, with subrecipes located in `_subrecipes/`.
2020-03-01 10:04:49 +00:00
Here's an example recipe, which could be saved to `_recipes/chocolate_cake.md`:
```yaml
2020-02-29 20:44:29 +00:00
---
name: Chocolate cake
2020-02-29 20:36:58 +00:00
author: Jane Crocker
2020-03-03 14:14:16 +00:00
difficulty: 2
ingredients:
- [1, egg, null]
- [2, butter, sticks]
- [2, flour, cups]
# et cetera
method:
- Preheat the oven to 200°C
- Whisk the egg finely
# et cetera
time: 240
2020-02-29 20:44:29 +00:00
---
```
- `name` (string) - The displayed name of the recipe. Does not appear in the URL.
2020-02-29 20:36:58 +00:00
- `author` (string, optional) - The author of the recipe.
2020-03-03 14:14:16 +00:00
- `difficulty` (float, optional) - The difficulty of the recipe on a scale of 1 to 5. Will be displayed as a star rating. Half stars (e.g. "2.5") are allowed.
2020-03-01 08:38:27 +00:00
- `ingredients` (list) - Each entry in `ingredients` is an array consisting of up to four items:
2020-03-01 10:04:49 +00:00
- amount (number or array) - The amount of this item to add, e.g. `2` for 2 cups of flour.
- If this is `0`, the output will be e.g. "jalepeño chillis to taste" rather than "0 jalepeño chillis".
2020-03-01 10:07:29 +00:00
- If this is an array, it will be printed as `amount[0] to amount[1]`. For example, if you wanted to say "2 to 3 cups of peas", you would write `[[2, 3], peas, cups]`.
2020-03-01 08:38:27 +00:00
- ingredient name (string) - The name of the ingredient, e.g. `flour` for 2 cups of flour.
- unit terminology (string, optional) - The unit that amount refers to, e.g. `cups` for 2 cups of flour. If left blank or null, as in `[1, egg]`, the output will simply be "1 egg".
- optional (boolean, optional) - Whether or not this ingredient is optional. The ingredient `[1, chocolate egg, null, true]` produces "1 chocolate egg" and marks is as optional. Defaults to `false`.
- `method` (list) - A list of steps undertaken to create the recipe, written in plain English. Or whatever language you prefer.
2020-02-29 20:36:58 +00:00
- `time` (string, optional) - The time it takes to make the recipe in minutes.
2020-02-29 20:44:29 +00:00
The recipe's file name isn't important, but it's good practice to make it something obvious, like `chocolate_cake.md` and not `strawberry_pie.md`.
2020-03-01 10:04:49 +00:00
The recipe files are standard YAML. Every recipe **must** begin and end with three dashes [to ensure that Jekyll processes it](https://jekyllrb.com/docs/front-matter/). Jekyll only processes files with certain extensions. Even though the recipes are formatted as YAML, they can't be saved as `.yml` or `.yaml` files - they must be saved with an extension that Jekyll will process, like `.md` or `.html`.
2020-02-29 21:07:20 +00:00
Good:
```yaml
---
name: Example
---
```
Bad:
```yaml
name: Example
```
### Subrecipes
Subrecipes behave a little differently to regular recipes:
- They don't show up on the home page
- The `time` tag is not supported
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
2020-02-29 20:44:29 +00:00
---
name: Chocolate icing
parents:
- chocolate_cake
- chocolate_cupcakes
2020-02-29 20:44:29 +00:00
ingredients:
- [250, chocolate, grams]
# et cetera
---
```
2020-02-29 20:44:29 +00:00
The entries in `parents` refer to the filenames of the parent recipes - `chocolate_cake` refers to `chocolate_cake.md`.
2020-02-29 20:36:58 +00:00
If a subrecipe does not have at least one valid `parents` entry, it will not appear anywhere on the website.
2020-03-01 06:13:27 +00:00
## Licensing
2020-03-03 14:14:16 +00:00
This software makes use of a subset of Font Awesome v4.7.0, which is licensed under the [SIL](https://scripts.sil.org/OFL_web).
2020-02-29 20:36:58 +00:00
This software is licensed under the [Apache 2.0 license](https://choosealicense.com/licenses/apache-2.0/).
Copyright 2020 Lynnesbian
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.