Resolve today to page for current date
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6d0551d08e
commit
077d76462c
26
main.go
26
main.go
|
@ -301,9 +301,7 @@ func (h *historyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
r.ParseForm()
|
||||
page := r.URL.Path[9:]
|
||||
if page == "" {
|
||||
page = "Home"
|
||||
}
|
||||
page = resolvePageName(page)
|
||||
|
||||
history, err := mp.PageHistory(page)
|
||||
if err != nil {
|
||||
|
@ -411,9 +409,7 @@ func (h *editHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
page := r.URL.Path[6:]
|
||||
if page == "" {
|
||||
page = "Home"
|
||||
}
|
||||
page = resolvePageName(page)
|
||||
|
||||
mpPage := mp.Get(page)
|
||||
pageText := mpPage.Content
|
||||
|
@ -462,7 +458,7 @@ func (h *editHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
Editor: editor,
|
||||
Name: page,
|
||||
Backrefs: mpPage.Refs,
|
||||
TodayPage: todayPage(),
|
||||
TodayPage: "Today",
|
||||
ShowGraph: page != "Daily_Notes",
|
||||
}
|
||||
templates := baseTemplate
|
||||
|
@ -595,9 +591,7 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
page := r.URL.Path[1:]
|
||||
if page == "" {
|
||||
page = "Home"
|
||||
}
|
||||
page = resolvePageName(page)
|
||||
|
||||
mpPage := mp.Get(page)
|
||||
pageText := mpPage.Content
|
||||
|
@ -676,7 +670,7 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
Name: page,
|
||||
Backrefs: mpPage.Refs,
|
||||
ShowGraph: page != "Daily_Notes",
|
||||
TodayPage: todayPage(),
|
||||
TodayPage: "Today",
|
||||
}
|
||||
templates := baseTemplate
|
||||
templates = append(templates, "templates/view.html")
|
||||
|
@ -924,3 +918,13 @@ func createSearchIndex(dataDir, indexName string) (bleve.Index, error) {
|
|||
return searchIndex, nil
|
||||
}
|
||||
}
|
||||
|
||||
func resolvePageName(name string) string {
|
||||
if name == "" {
|
||||
return "Home"
|
||||
}
|
||||
if name == "Today" {
|
||||
return todayPage()
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user