package bot import ( "html/template" "net/http" "strings" ) func (b *bot) serveRoot(w http.ResponseWriter, r *http.Request) { context := make(map[string]interface{}) context["Nav"] = b.GetWebNavigation() t := template.Must(template.New("rootIndex").Parse(rootIndex)) t.Execute(w, context) } // GetWebNavigation returns a list of bootstrap-vue links // The parent is not included so each page may display it as // best fits func (b *bot) GetWebNavigation() []EndPoint { endpoints := b.httpEndPoints moreEndpoints := b.config.GetArray("bot.links", []string{}) for _, e := range moreEndpoints { link := strings.SplitN(e, ":", 2) if len(link) != 2 { continue } endpoints = append(endpoints, EndPoint{link[0], link[1]}) } return endpoints } var rootIndex = ` Factoids catbase {{ "{{ item.Name }}" }} `