Repository navigation
v1.6.0 — htmx SPA integration
Server-rendered apps that feel like a SPA with htmx — one template set, no client build step. See the htmx guide.
Fragment rendering
ctx.View("page#form", data)renders a single{{block}}/{{define}}of a view through the same minify/ETag pipeline as full pages.ctx.ViewPartial(name, fragment, data)— fragment for htmx partial requests, full page for everyone else (deep links, back button, JS-off).- Breaking (parse time only):
#is now reserved — registering a template or component name containing it panics at parse time.
htmx helpers
- Predicates
ctx.IsBoosted()andctx.WantsPartial()(pure header reads;IsHTMX()unchanged). app.HTMXAwareRedirect(opt-in): the wholeRedirectfamily answers partial htmx requests withHX-Redirect+ 204 instead of a 3xx, so post/redirect/get + flash flows work unchanged over htmx.- New chainable helpers:
HTMXPushURL,HTMXReplaceURL,HTMXNoPush,HTMXReselect,HTMXLocation,HTMXTriggerAfterSwap,HTMXTriggerAfterSettle. - Behavior change: repeated
HTMXTriggercalls now merge into one header instead of clobbering (merged events serialize in alphabetical order).
Caching
ctx.NoCache()— chainableCache-Control: no-store.ctx.VaryHTMX()— chainableVary: HX-Request, HX-Boosted, HX-History-Restore-Requestfor cacheable responses that branch on htmx headers. Nothing sets Vary automatically; call it when you need it.
Docs
- README htmx section: partial rendering, out-of-band swap pattern, active-nav recipe, 422 validation config, caching guidance.
- Modernized CSRF guidance: explicit
SameSitecookies + Go 1.25'shttp.NewCrossOriginProtectioninstead of token middleware (#124).
Full changelog: v1.5.0...v1.6.0 (#123, #124)