Let’s do a simple case study. Our recipe is “Egg and bacon”, which only uses “Egg” and “Bacon”. No seasoning or any other stuff. Lets keep it simple. If I understood you correctly this would result in these files:
- “Egg” - A food/Lebesmittel (from now on called ingredient) note also with references to “Egg and bacon” and some amount
- “Bacon” - A ingredient note also with references to “Egg and bacon” with an amount
- “Egg and bacon” - A recipe file, with no references to which ingredients it actually consists of… But it’s listed by text from the ingredients file…
Change recipe structure?
To me this structure seems backwards. I’d much rather have the ingredients listed in the recipe, instead of listing the recipes it is used in at each and every ingredient. With current structure when you add another recipe you need to edit every single ingredient of that recipe, and if you change the recipe you would also need to remember to remove/add it to those ingredients being changed.
To me a better structure would look something like:
---
type: recipe
ingredients:
- name: "[[Egg]]"
amount: 2
- name: "[[Bacon]]"
amount: 5
---
And then use that in a query to calculate all the other stuff. Just for the sake of it with some random calories noted in the ingredients file, I could use this query:
```dataview
TABLE WITHOUT ID
i.name as Ingredient,
i.amount as Amount,
i.name.calories * i.amount as "Calories"
WHERE file = this.file
FLATTEN ingredients as i
```
With an output of:

Using text recipe names in ingredients
Now onto what you really asked about, which wasn’t my ramblings on a better structure. You’d need to loop through every ingredients in your vault, expand the file lists into recipes, and then pick out those matching your current recipes. In query form this look like this:
```dataview
TABLE WITHOUT ID
file.link as Ingredient,
amount as Amount,
amount * calories as Calories
WHERE type = "Lebensmittel"
FLATTEN file.lists as recipe
WHERE startswith(recipe.text, this.file.name)
FLATTEN recipe[this.file.name] as amount
```
Here we use the [ ... ]
to pick out a given field from an object, since we most assuredly do have space and what not in the recipe name.
Change to links for the recipes?
Another note regarding this structure, sorry if it’s too much comments on that, but as long as you don’t have the recipes linked from the ingredients, if you decide to change the name of a recipe you’ll have to manually go through your ingredients list and correct the recipe name. Sadly you can’t just switch to it being a link either, as then it can’t be used as an inline field.
You could potentially use something like:
- [[Boiled egg]] [amount:: 1]
Which would require this change to the ingredients query:
```dataview
TABLE WITHOUT ID
file.link as Ingredient,
amount as Amount,
amount * calories as Calories
FROM [[]]
FLATTEN file.lists as recipe
WHERE recipe.amount AND contains(recipe.outlinks, this.file.link)
FLATTEN recipe.amount as amount
```
This has the following advantages over the middle query:
- It only queries on files linked to this recipe, so it doesn’t run through the entire ingredients list
- It allows for recipes to be renamed, where Obsidian will change all occurrences of the link automatically
My summary thoughts
In summary, I think it would be better to switch around so that the recipe holds the ingredients, instead of the ingredients having the recipes. It just makes more sense in my head.
If you continue with the ingredients having the recipes, I would strongly suggest to switch to a syntax similar to: - [[recipe 1]] [amount: 3]
to allow for better handling of recipe renames and simpler queries without having to scan all of the ingredients.