recipes

The recipes and recipe books used in our family
git clone git://archive.git.mtrnord.blog/MTRNord/recipes.git
Log | Files | Refs | README | LICENSE

commit 44e61839f69c7c91f6402e8a648a2ee6b383ee2f
parent 2a049b41b9f1d92285dd19d16c06b72b1ac3ab5f
Author: MTRNord <mtrnord1@gmail.com>
Date:   Mon, 13 Nov 2023 22:22:33 +0100

Improve rendering

Diffstat:
Msrc/components/recipe.astro | 18++++++++++++------
Msrc/content/docs/recipes/käsekuchen.mdoc | 1+
Msrc/content/docs/recipes/test.mdoc | 1+
3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/components/recipe.astro b/src/components/recipe.astro @@ -1,16 +1,14 @@ --- import type { Props } from "@astrojs/starlight/props"; -import { - Recipe as CooklangRecipe, - type Text as CooklangText, - type Step, -} from "@cooklang/cooklang-ts"; +import { Recipe as CooklangRecipe } from "@cooklang/cooklang-ts"; import Default from "@astrojs/starlight/components/MarkdownContent.astro"; const isRecipe = Astro.props.slug.includes("recipes"); const recipe = new CooklangRecipe(Astro.props.entry.body, { defaultIngredientAmount: "etwas", }); +const meta_array = Array.from(Object.entries(recipe.metadata)); +const contains_source = meta_array.find(([key, _value]) => "source" == key); const source_url_raw = recipe.metadata.source ?? ""; const source_url = source_url_raw.replace("<", "").replace(">", ""); --- @@ -27,7 +25,15 @@ const source_url = source_url_raw.replace("<", "").replace(">", ""); <p>Keine Quelle angegeben</p> )} - <h3 id="extra">Extra</h3> + { + (contains_source && meta_array.length >= 2) || !contains_source && meta_array.length >= 1 ? + ( + <h3 id="extra">Extra</h3> + ) : + ( + <></> + ) + } {Array.from(Object.entries(recipe.metadata)).map( ([key, value]) => key === "source" ? null : ( diff --git a/src/content/docs/recipes/käsekuchen.mdoc b/src/content/docs/recipes/käsekuchen.mdoc @@ -1,5 +1,6 @@ --- title: Käsekuchen +tableOfContents: false --- >> source: <https://www.jamieoliver.com/recipes/eggs-recipes/easy-pancakes/> diff --git a/src/content/docs/recipes/test.mdoc b/src/content/docs/recipes/test.mdoc @@ -1,5 +1,6 @@ --- title: Test +tableOfContents: false --- >> servings: 1 >> produce: 240%g