diff --git a/WikiServer.go b/WikiServer.go index fde6b4f..eb324b4 100644 --- a/WikiServer.go +++ b/WikiServer.go @@ -1,6 +1,7 @@ package yatwiki3 import ( + "database/sql" "errors" "fmt" "html/template" @@ -28,6 +29,14 @@ func NewWikiServer(opts *ServerOptions) (*WikiServer, error) { return nil, err } + tr, err := wdb.TotalRevisions() + if (err == nil && tr == 0) || err == sql.ErrNoRows { + err := wdb.SaveArticle(opts.DefaultPage, `YATWiki3`, "", 0) + if err != nil { + return nil, err + } + } + tmpl, err := template.New("yatwiki/page").Parse(pageTemplate) if err != nil { return nil, err