package yatwiki import ( "fmt" "html/template" "net/http" "net/url" ) func (this *WikiServer) routeIndex(w http.ResponseWriter, r *http.Request) { titles, err := this.db.ListTitles(true) // Always load deleted pages, even if we don't display them in the list if err != nil { this.serveInternalError(w, r, err) return } showDeleted := (r.FormValue("deleted") == "1") anyDeleted := false totalRevs, err := this.db.TotalRevisions() if err != nil { this.serveInternalError(w, r, err) return } content := fmt.Sprintf(`

Article Index


There are %d edits to %d pages.

` if anyDeleted { content += `
` if !showDeleted { content += `Show deleted pages` } else { content += `Hide deleted pages` } } pto := DefaultPageTemplateOptions(this.opts) pto.CurrentPageName = "Index" pto.Content = template.HTML(content) this.servePageResponse(w, r, pto) return }