Skip to content

E0417: A view doesn't fit its template ​

@web.Template("page.templ", "Name") renders a handler's result with a component of a .templ file vuka compiled. The file has no such component (or several, so one must be named), or the component's parameters don't match the result's fields by name and type. Reported at boot.

Wrong ​

vuka
// pets.templ: templ PetList(pets []Pet)
@web.Get("/pets")
@web.Template("pets.templ", "PetList")
func ListPets() []Pet { … }
vuka
// pets.templ: templ PetList(pets []Pet)
type PetsPage struct{ Pets []Pet }

@web.Get("/pets")
@web.Template("pets.templ", "PetList")
func ListPets() PetsPage { … }

Released under the MIT License. Vuka builds on Go and its tools, which are made by the Go Authors. Vuka is not affiliated with Google or the Go project. Go is a trademark of Google LLC.