package pages import ( "html/template" "io" "path/filepath" ) type Page struct { Path string Dirs []string Files []string // Created in Render. BreadCrumbs []Directory } func (ctx Page) FullPath(dir string) string { return filepath.Join(ctx.Path, dir) } func (ctx Page) Render(w io.Writer) { crumbs := []Directory{} current := Directory(ctx.Path) for current != "/" { crumbs = append([]Directory{current}, crumbs...) current = Directory(filepath.Dir(string(current))) } ctx.BreadCrumbs = crumbs authRegisterTmpl.Execute(w, ctx) } var authRegisterTmpl = template.Must(template.New("").Parse(`