Adds category and sorts recipes by name
This commit is contained in:
parent
aa02133b9e
commit
600a26a91f
5 changed files with 41 additions and 14 deletions
|
@ -12,12 +12,19 @@
|
|||
<div id="content">
|
||||
<h1>{{.title}}</h1>
|
||||
|
||||
{{if ne (len .recipes) 0}}
|
||||
<ul>
|
||||
{{range .recipes}}
|
||||
<li><a href="{{.Path}}">{{.Name}}</a></li>
|
||||
{{$categoryMap := .categoryMap}}
|
||||
{{$recipes := .recipes}}
|
||||
{{range .categoryList}}
|
||||
{{if (ne . "")}}
|
||||
<h3>{{.}}</h3>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{$recipeList := index $categoryMap .}}
|
||||
|
||||
<ul>
|
||||
{{range $name := $recipeList}}
|
||||
<li><a href="{{index $recipes $name}}">{{$name}}</a></li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{end}}
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
@ -26,9 +26,10 @@
|
|||
<ul>
|
||||
{{$m := .recipe.Metadata}}
|
||||
{{$nameKey := .nameKey}}
|
||||
{{$categoryKey := .categoryKey}}
|
||||
{{$urlKey := .urlKey}}
|
||||
{{range $k := sortedMetadataKeys $m}}
|
||||
{{if and (ne $k $nameKey) (ne $k $urlKey)}}
|
||||
{{if and (ne $k $nameKey) (ne $k $categoryKey) (ne $k $urlKey)}}
|
||||
<li><em>{{$k}}:</em> {{index $m $k}}</li>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue