diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go index 7acf2f1..acdeabb 100644 --- a/cmd/web/handlers.go +++ b/cmd/web/handlers.go @@ -13,8 +13,16 @@ func (app *application) home(w http.ResponseWriter, r *http.Request) { http.NotFound(w, r) return } + data := newTemplateData(r) + data.Title = "Home" - app.renderPage(w, http.StatusOK, "home.tmpl.html", nil) + app.renderPage(w, http.StatusOK, "home.tmpl.html", data) +} + +func (app *application) feedgenView(w http.ResponseWriter, r *http.Request) { + data := newTemplateData(r) + data.Title = "Feed Generator" + app.renderPage(w, http.StatusOK, "feedgenview.tmpl.html", data) } func (app *application) generateRss(w http.ResponseWriter, r *http.Request) { diff --git a/cmd/web/routes.go b/cmd/web/routes.go index d2bad00..c0d5fd9 100644 --- a/cmd/web/routes.go +++ b/cmd/web/routes.go @@ -10,7 +10,8 @@ func (app *application) routes() http.Handler { r.Handle("/static/*", http.StripPrefix("/static", fileServer)) r.Get("/", app.home) - r.Get("/generate", app.generateRss) + r.Get("/feedgen", app.feedgenView) + r.Get("/feedgen/generate", app.generateRss) return r } diff --git a/cmd/web/templates.go b/cmd/web/templates.go index 2e6429c..44ea304 100644 --- a/cmd/web/templates.go +++ b/cmd/web/templates.go @@ -10,6 +10,7 @@ import ( type templateData struct { CurrentYear int Feeds []string + Title string } func newTemplateCache() (map[string]*template.Template, error) { diff --git a/ui/html/base.tmpl.html b/ui/html/base.tmpl.html index d06fe18..7715349 100644 --- a/ui/html/base.tmpl.html +++ b/ui/html/base.tmpl.html @@ -4,13 +4,23 @@
-