Use map for entries and slice for toc instead of iterating over slice with Entries every time
This commit is contained in:
parent
daaddbb56b
commit
97e4cbb158
2 changed files with 13 additions and 33 deletions
4
main.go
4
main.go
|
@ -37,11 +37,11 @@ func handleApplication(w http.ResponseWriter, req *http.Request) {
|
|||
return
|
||||
}
|
||||
// load entry
|
||||
entry = db.Entry(entryName)
|
||||
entry = db.Entries[entryName]
|
||||
}
|
||||
err = appTemplate.ExecuteTemplate(
|
||||
w, "app",
|
||||
TemplateData{TOC: db.TOC(), Entry: entry, Title: MainTitle, EntryTitle: entryName})
|
||||
TemplateData{TOC: db.Keys, Entry: entry, Title: MainTitle, EntryTitle: entryName})
|
||||
if err != nil { logger.Println(err) }
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue