Recipe Shortcode#
Display recipe ingredients with automatic scaling functionality.
Usage#
{{< recipe id="cookies" >}}
- 2 cups flour
- 1/2 cup sugar
- 3/4 teaspoon salt
- 1 1/2 cups chocolate chips
{{< /recipe >}}With scale input:
{{< scale-input id="cookies" >}}
{{< recipe id="cookies" >}}
- 2 cups flour
- 1 cup sugar
{{< /recipe >}}Parameters#
| Parameter | Default | Required | Description |
|---|---|---|---|
id | - | Yes | Unique identifier for the recipe |
scale | 1 | No | Initial scale factor |
Features#
- Automatic scaling: Quantities adjust when scale changes
- Smart fractions: Supports whole numbers, fractions (1/2), and mixed numbers (1 3/4)
- Fraction rounding: Scales values are rounded to nearest common fractions
- Compatible: Works with scale-input, scale-val, and cone-calc shortcodes
- Visual feedback: Shows note when recipe is scaled
Supported Fractions#
The shortcode recognizes and properly scales these fraction formats:
- Whole numbers:
2,4 - Simple fractions:
1/2,3/4,1/3,2/3 - Mixed numbers:
1 1/2,2 3/4
Scaled values are rounded to: 1/4, 1/3, 1/2, 2/3, 3/4
Notes#
- Each recipe on a page must have a unique
id - List items must start with a hyphen
- - Only the first number in each line is scaled
- Recipe exposes
updateScale()function for programmatic control - Best used with scale-input or cone-calc for user interaction