package routes import ( "html/template" "github.com/mikestefanello/pagoda/controller" "github.com/labstack/echo/v4" ) type ( About struct { controller.Controller } AboutData struct { ShowCacheWarning bool FrontendTabs []AboutTab BackendTabs []AboutTab } AboutTab struct { Title string Body template.HTML } ) func (c *About) Get(ctx echo.Context) error { page := controller.NewPage(ctx) page.Layout = "main" page.Name = "about" page.Title = "About" // This page will be cached! page.Cache.Enabled = true page.Cache.Tags = []string{"page_about", "page:list"} // A simple example of how the Data field can contain anything you want to send to the templates // even though you wouldn't normally send markup like this page.Data = AboutData{ ShowCacheWarning: true, FrontendTabs: []AboutTab{ { Title: "HTMX", Body: template.HTML(`Completes HTML as a hypertext by providing attributes to AJAXify anything and much more. Visit htmx.org to learn more.`), }, { Title: "Alpine.js", Body: template.HTML(`Drop-in, Vue-like functionality written directly in your markup. Visit alpinejs.dev to learn more.`), }, { Title: "Bulma", Body: template.HTML(`Ready-to-use frontend components that you can easily combine to build responsive web interfaces with no JavaScript requirements. Visit bulma.io to learn more.`), }, }, BackendTabs: []AboutTab{ { Title: "Echo", Body: template.HTML(`High performance, extensible, minimalist Go web framework. Visit echo.labstack.com to learn more.`), }, { Title: "Ent", Body: template.HTML(`Simple, yet powerful ORM for modeling and querying data. Visit entgo.io to learn more.`), }, }, } return c.RenderPage(ctx, page) }