Skip to content

E0708: A folder's layout or Guard is malformed ​

A folder's layout, the struct its _layout.vuka.html declares, wraps the pages below it: an exported struct with a field Children ui.Node, where the page (or the next layout) renders, and markup of its own. A Load method, when it has one, takes context.Context and then what the container provides, and returns an error. A folder's Guard checks the routes below it and renders nothing: a struct whose Load(ctx context.Context, deps…) error it must have. Reported at the type, the field or the method.

Wrong ​

html
<!-- pages/employers/[employer]/_layout.vuka.html -->
<script lang="go">
package employer

type Layout struct {
	Employer int
	Body     ui.Node
}

func (l *Layout) Load(s *Store) Employer { … }
</script>

<article>{Body}</article>
html
<!-- pages/employers/[employer]/_layout.vuka.html -->
<script lang="go">
package employer

type Layout struct {
	Employer int
	Children ui.Node
	name     string
}

func (l *Layout) Load(ctx context.Context, s *Store) error { … }
</script>

<article><h1>{name}</h1>{Children}</article>

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.