diff --git a/controllers/home.go b/controllers/home.go index 8bab486..fc64c9d 100644 --- a/controllers/home.go +++ b/controllers/home.go @@ -13,6 +13,8 @@ func (h *Home) Get(c echo.Context) error { p.Layout = "main" p.Name = "home" p.Data = "Hello world" + p.Metatags.Description = "Welcome to the homepage." + p.Metatags.Keywords = []string{"Go", "MVC", "Web", "Software"} return h.RenderPage(c, p) } diff --git a/controllers/login.go b/controllers/login.go new file mode 100644 index 0000000..79c28e0 --- /dev/null +++ b/controllers/login.go @@ -0,0 +1,24 @@ +package controllers + +import ( + "github.com/labstack/echo/v4" +) + +type Login struct { + Controller +} + +func (l *Login) Get(c echo.Context) error { + p := NewPage(c) + p.Layout = "auth" + p.Name = "login" + p.Title = "Log in" + p.Data = "This is the login page" + return l.RenderPage(c, p) +} + +//func (a *Contact) Post(c echo.Context) error { +// msg.Set(c, msg.Success, "Thank you for contacting us!") +// msg.Set(c, msg.Info, "We will respond to you shortly.") +// return a.Redirect(c, "home") +//} diff --git a/router/router.go b/router/router.go index 0aa5714..559ce9f 100644 --- a/router/router.go +++ b/router/router.go @@ -61,5 +61,6 @@ func navRoutes(e *echo.Echo, ctr controllers.Controller) { } func userRoutes(e *echo.Echo, ctr controllers.Controller) { - // TODO + login := controllers.Login{Controller: ctr} + e.GET("/user/login", login.Get).Name = "login" } diff --git a/views/components/head.gohtml b/views/components/head.gohtml new file mode 100644 index 0000000..27479b5 --- /dev/null +++ b/views/components/head.gohtml @@ -0,0 +1,16 @@ +{{define "metatags"}} +