diff --git a/README.md b/README.md
index 50a1755..a22f982 100644
--- a/README.md
+++ b/README.md
@@ -16,3 +16,5 @@ A simple CLI tool to generate a static website from a
- [ ] Add command to copy the embedded templates to an external
directory.
- [ ] Allow to read the templates from an external directory.
+- [X] Add a category metadata key.
+- [X] Sort recipes by name key.
diff --git a/cmd.go b/cmd.go
index 49deccf..7cba28d 100644
--- a/cmd.go
+++ b/cmd.go
@@ -4,6 +4,7 @@ type generateCmd struct {
Path string `arg:"" help:"Path to the directory with the recipes."`
Output string `default:"dist" help:"Path to the directory where the files will be generated."`
NameKey string `default:"name" short:"n" help:"The metadata key for the recipe name."`
+ CategoryKey string `default:"category" short:"c" help:"The metadata key for the categories."`
URLKey string `default:"url" short:"u" help:"The metadata key for the recipe URL."`
Title string `default:"Recipes directory" short:"t" help:"The title to use at the recipe index."`
IngredientsTitle string `default:"Ingredients" short:"i" help:"The title to use at the list of ingredients of each recipe"`
diff --git a/sandwitchboard.go b/sandwitchboard.go
index 19435c0..01d015f 100644
--- a/sandwitchboard.go
+++ b/sandwitchboard.go
@@ -17,6 +17,8 @@ import (
"github.com/aquilax/cooklang-go"
)
+// ToDo: añadir la cantidad a los ingredientes y timers, quizá en un
+// X-data-quantity
const (
stepPrefix = "
{{.title}}
- {{if ne (len .recipes) 0}}
-
- {{range .recipes}}
- - {{.Name}}
+ {{$categoryMap := .categoryMap}}
+ {{$recipes := .recipes}}
+ {{range .categoryList}}
+ {{if (ne . "")}}
+ {{.}}
{{end}}
-
+ {{$recipeList := index $categoryMap .}}
+
+
+ {{range $name := $recipeList}}
+ - {{$name}}
+ {{end}}
+
{{end}}
diff --git a/templates/recipe.html.tmpl b/templates/recipe.html.tmpl
index c1aa431..e1d9fa1 100644
--- a/templates/recipe.html.tmpl
+++ b/templates/recipe.html.tmpl
@@ -26,9 +26,10 @@