diff --git a/extensions/book/book.go b/extensions/book/book.go index b4d959a8..f216485f 100644 --- a/extensions/book/book.go +++ b/extensions/book/book.go @@ -3,6 +3,7 @@ package book import ( "embed" "html/template" + "io/fs" "strings" "github.com/emad-elsaid/xlog" @@ -30,9 +31,26 @@ func init() { }) xlog.RegisterTemplate(templates, "templates") xlog.RegisterStaticDir(public) + registerBuildFiles() xlog.RegisterWidget(xlog.HEAD_WIDGET, 0, style) } +func registerBuildFiles() { + fs.WalkDir(public, ".", func(path string, d fs.DirEntry, err error) error { + if err != nil { + return err + } + + if d.IsDir() { + return nil + } + + xlog.RegisterBuildPage("/"+path, false) + + return nil + }) +} + func style(xlog.Page) template.HTML { return `` }