-
+ {{- range $index, $tab := .}}
+
- {{.Title}} + {{- end}} +
→ {{.Body}}
diff --git a/routes/about.go b/routes/about.go index 07a8c32..6eeba36 100644 --- a/routes/about.go +++ b/routes/about.go @@ -15,7 +15,8 @@ type ( AboutData struct { ShowCacheWarning bool - Tabs []AboutTab + FrontendTabs []AboutTab + BackendTabs []AboutTab } AboutTab struct { @@ -35,9 +36,10 @@ func (c *About) Get(ctx echo.Context) error { 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, - Tabs: []AboutTab{ + 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.`), @@ -51,6 +53,16 @@ func (c *About) Get(ctx echo.Context) error { 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) diff --git a/templates/pages/about.gohtml b/templates/pages/about.gohtml index 0a71219..06524c2 100644 --- a/templates/pages/about.gohtml +++ b/templates/pages/about.gohtml @@ -1,22 +1,20 @@ {{define "content"}} - {{if .Data.Tabs}} + {{- if .Data.FrontendTabs}} +
Frontend
The following incredible projects make developing advanced, modern frontends possible and simple without having to write a single line of JS or CSS. You can go extremely far without leaving the comfort of Go with server-side rendered HTML.
-{{.Body}}
Backend
+The following incredible projects provide the foundation of the Go backend. See the repository for a complete list of included projects.
+ {{template "tabs" .Data.BackendTabs}} + {{end}} - {{if .Data.ShowCacheWarning}} -