21 lines
846 B
JSON
21 lines
846 B
JSON
{{- $allRecettes := newScratch -}}
|
|
{{- $allRecettes.Add "index" slice -}}
|
|
{{- range .Site.RegularPages -}}
|
|
{{ $recette := (dict "title" .Title "permalink" .Permalink "categories" .CurrentSection.Title) }}
|
|
|
|
{{- $ingredients := newScratch -}}
|
|
{{- $ingredients.Add "ingredients" slice -}}
|
|
{{- range .Params.steps -}}
|
|
{{- range .ingredients -}}
|
|
{{- $ingredients.Add "ingredients" .name -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
|
|
{{- $ingredientsArray := $ingredients.Get "ingredients" -}}
|
|
{{- $ingredientsContent := delimit $ingredientsArray ", " -}}
|
|
{{- $recette := merge $recette (dict "ingredients" $ingredientsArray) -}}
|
|
{{- $recette := merge $recette (dict "contents" $ingredientsContent) -}}
|
|
{{- $allRecettes.Add "index" $recette -}}
|
|
{{- end -}}
|
|
{{- $allRecettes.Get "index" | jsonify -}}
|