Introduction

htmgo is a lightweight pure go way to build interactive websites / web applications using go & htmx.

We give you the utilities to build html using pure go code in a reusable way (go functions are components) while also providing htmx functions to add interactivity to your app.

Copy
 1func DocsPage(ctx *h.RequestContext) *h.Page {
 2	pages := dirwalk.WalkPages("md/docs")
 3	return h.NewPage(
 4	h.Div(
 5		h.Class("flex flex-col md:flex-row gap-4"),
 6		DocSidebar(pages),
 7		h.Div(
 8			h.Class("flex flex-col justify-center items-center mt-6"),
 9			h.List(pages, func(page *dirwalk.Page, index int) *h.Element {
10				return h.Div(
11					h.Class("border-b border-b-slate-300"),
12					MarkdownContent(ctx, page),
13				)
14			}),
15		 ),
16	  ),
17}

The site you are reading now was written with htmgo!